From: php at ibeni dot net
Operating system: FreeBSD c1 6.3-RELEASE
PHP version: 5.2.6
PHP Bug Type: GD related
Bug description: imagettftext() function doesn't handle UTF-8 encoded strings
Description:
------------
Passing UTF-8 encoded text with Japanese characters to imagettftext()
produces incorrect output. Works correctly on my Ubuntu 7.10 machine, but
broken on FreeBSD 6.3, web server.
Reproduce code:
---------------
mb_language('uni');
mb_internal_encoding('UTF-8');
header('Content-type: image/gif');
$text = '日本語'; //Japanese text
$font = './Cyberbit.ttf';
// Create the image
$im = imagecreatetruecolor(160, 160);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// Create some colors
imagefilledrectangle($im, 0, 0, 159, 159, $white);
// Add the text
imagettftext($im, 12, 0, 20, 20, $black, $font, $text);
imagegif($im);
imagedestroy($im);
Expected result:
----------------
Copy of correct image from my local machine:
http://www.ibeni.net/flashcards/imagetest.php.gif
Copy of phpinfo() from my local machine:
http://www.ibeni.net/flashcards/phpinfo.php.html
Actual result:
--------------
Broken Image on web server: http://www.ibeni.net/flashcards/imagetest.php
Copy of phpinfo() from my webhost server:
http://example5.nfshost.com/phpinfo
--
Edit bug report at http://bugs.php.net/?id=46293&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46293&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46293&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46293&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46293&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46293&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46293&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46293&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46293&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46293&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46293&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46293&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46293&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46293&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46293&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46293&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46293&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46293&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46293&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46293&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46293&r=mysqlcfg