#49153 [NEW]: combining characters in UTF-8 doesn't seem to work

From: Date: Tue, 04 Aug 2009 14:05:42 +0000
Subject: #49153 [NEW]: combining characters in UTF-8 doesn't seem to work
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140643@lists.php.net to get a copy of this message
From:             andy at bdnews24 dot com
Operating system: Win Server 2003 Enterprise SP2
PHP version:      5.2.10
PHP Bug Type:     GD related
Bug description:  combining characters in UTF-8 doesn't seem to work

Description:
------------
Using imagettftext some Bengali unicode text that combines characters
(uses diacritics) doesn't render properly: it displays too many characters.
Maybe the same as this (ancient) post:
http://www.mail-archive.com/php-general@lists.php.net/msg78902.html.
I'm
afraid I can't find a free unicode Bengali font - I used MS Arial Unicode.
I've made a zip file with a screenshot and the repro code (in case the
UTF-8 string literal screws up on the way to your database;) that's
available at http://cl-t199-020cl.privatedns.com/repro.zip.

Reproduce code:
---------------
<?
header('Content-type: text/html; charset=utf-8');
if (!mb_internal_encoding("UTF-8"))
	p_echo("couldn't set internal encoding to utf-8");

$string="&#2459;&#2494;&#2468;&#2509;&#2480;
&#2476;&#2495;&#2453;&#2509;&#2487;&#2507;&#2477;&#2503;&#2480;";
$text_size=12;

$im = imagecreate(15*$text_size,$text_size);
imagecolorallocate($im,255,255,255); //bg colour
$black=imagecolorallocate($im,0,0,0); //fg colour

imagettftext($im, $text_size, 0, 0, $text_size, $black, "arialuni.ttf",
$string);
imagegif($im, "repro.gif");

echo($string."<br>");
echo("<img src=\"repro.gif\">");
?>


Expected result:
----------------
I expect to see two copies of the same text. The top copy is text rendered
by the browser, the bottom copy is a gif file.

Actual result:
--------------
The browser-rendered text displays correctly, the gif file is different
and incorrect.

-- 
Edit bug report at http://bugs.php.net/?id=49153&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=49153&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=49153&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=49153&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=49153&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49153&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=49153&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=49153&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=49153&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=49153&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=49153&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=49153&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=49153&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=49153&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=49153&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49153&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49153&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=49153&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=49153&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=49153&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=49153&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=49153&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#140643) next »