<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi All,<br>
<br>
I found a display error on the vtiger 5.2.1. Dashboard. The UTF-8
characters were changed into a rectangular place-holder. I opened a
ticket for this issue: <b>Ticket #7028</b> on the track.<br>
<img alt="" src="cid:part1.08060703.07090304@gmail.com" height="561"
width="1031"><br>
<br>
The reason of this display error was the internal bug of <b>ImageTTFText()</b>
function in \Image\Canvas\GD.php file about the line #1405.<br>
<br>
The solution was already developed:<br>
<a class="moz-txt-link-freetext" href="http://hu.php.net/manual/en/function.imagettfbbox.php">http://hu.php.net/manual/en/function.imagettfbbox.php</a> (post by
Nashev)<br>
<a class="moz-txt-link-freetext" href="http://php.rinet.ru/manual/ru/function.imagettftext.php#57416">http://php.rinet.ru/manual/ru/function.imagettftext.php#57416</a> <br>
<br>
By adding the function described below to the \Image\Canvas\GD.php
file (to the Image_Canvas_GD Class) the problem is solved.<br>
<br>
<font face="Courier New, Courier, monospace"> #UTF8 - Character
support on the charts<br>
function foxy_utf8_to_nce( $utf ) <br>
{<br>
if($utf == '') <br>
{<br>
return($utf);<br>
}<br>
else <br>
{<br>
$max_count = 5; // flag-bits in $max_mark ( 1111 1000 == 5
times 1)<br>
$max_mark = 248; // marker for a (theoretical ;-))
5-byte-char and mask for a 4-byte-char;<br>
<br>
$html = '';<br>
for($str_pos = 0; $str_pos < strlen($utf); $str_pos++)
<br>
{<br>
$old_chr = $utf{$str_pos};<br>
$old_val = ord( $utf{$str_pos} );<br>
$new_val = 0;<br>
<br>
$utf8_marker = 0;<br>
<br>
// skip non-utf-8-chars<br>
if( $old_val > 127 ) <br>
{<br>
$mark = $max_mark;<br>
for($byte_ctr = $max_count; $byte_ctr > 2;
$byte_ctr--) <br>
{<br>
// actual byte is utf-8-marker?<br>
if( ( $old_val & $mark ) == ( ($mark
<< 1) & 255 ) ) <br>
{<br>
$utf8_marker = $byte_ctr - 1;<br>
break;<br>
}<br>
$mark = ($mark << 1) & 255;<br>
}<br>
}<br>
<br>
// marker found: collect following bytes<br>
if($utf8_marker > 1 and isset( $utf{$str_pos + 1} )
) <br>
{<br>
$str_off = 0;<br>
$new_val = $old_val & (127 >>
$utf8_marker);<br>
for($byte_ctr = $utf8_marker; $byte_ctr > 1;
$byte_ctr--) <br>
{<br>
<br>
// check if following chars are UTF8
additional data blocks<br>
// UTF8 and ord() > 127<br>
if( (ord($utf{$str_pos + 1}) & 192) == 128
) <br>
{<br>
$new_val = $new_val << 6;<br>
$str_off++;<br>
// no need for Addition, bitwise OR is
sufficient<br>
// 63: more UTF8-bytes; 0011 1111<br>
$new_val = $new_val | ( ord( $utf{$str_pos
+ $str_off} ) & 63 );<br>
}<br>
// no UTF8, but ord() > 127<br>
// nevertheless convert first char to NCE<br>
else {<br>
$new_val = $old_val;<br>
}<br>
}<br>
// build NCE-Code<br>
$html .= '&#'.$new_val.';';<br>
// Skip additional UTF-8-Bytes<br>
$str_pos = $str_pos + $str_off;<br>
}<br>
else {<br>
$html .= chr($old_val);<br>
$new_val = $old_val;<br>
}<br>
}<br>
return($html);<br>
}<br>
}</font><br>
<br>
<br>
Changing the line #1405 - #1414 the problem is solved:<br>
<br>
<font face="Courier New, Courier, monospace"> <b>ImageTTFText</b>(<br>
$this->_canvas,<br>
$this->_font['size'],<br>
$this->_font['angle'],<br>
$x,<br>
$y,<br>
$this->_color($color),<br>
$this->_font['file'],<br>
<font color="#009900"><b>// $line</b></font><br>
<b>Image_Canvas_GD::foxy_utf8_to_nce($line)</b>
//for UTF-8 support<br>
);</font><br>
<br>
<img alt="" src="cid:part2.09040202.06050501@gmail.com" height="565"
width="936"><br>
<div class="moz-signature">Cheers:<br>
<br>
Holbok István<br>
telefon: +3670-342-0900<br>
e-mail: <a href="mailto:holbok@gmail.com">holbok@gmail.com</a><br>
<br>
<b><br>
</b></div>
</body>
</html>