|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-10-14 16:16 UTC] php at ibeni dot net
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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 04:00:02 2025 UTC |
I see that bug submission forum has "helpfully" encoded the Japanese text in my code into HTML entities ('日本語'). In my original code, the text is encoded directly in UTF-8 _not_ HTML entities.