Req #46293 [Opn->Fbk]: imagettftext() function doesn't handle UTF-8 encoded strings
| From: | cmb@php.net | Date: | Wed, 18 Jan 2017 17:05:56 +0000 |
| Subject: | Req #46293 [Opn->Fbk]: imagettftext() function doesn't handle UTF-8 encoded strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206725@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46293&edit=1
ID: 46293
Updated by: cmb@php.net
Reported by: php at ibeni dot net
Summary: imagettftext() function doesn't handle UTF-8 encoded
strings
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: GD related
Operating System: FreeBSD c1 6.3-RELEASE
PHP Version: 5.2.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Does this issue still persist with current PHP/GD versions?
Previous Comments:
------------------------------------------------------------------------
[2009-10-22 18:17:54] coa at trash2009 dot com
Make sure your font supports the characters
------------------------------------------------------------------------
[2008-10-14 16:19:57] php at ibeni dot net
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.
------------------------------------------------------------------------
[2008-10-14 16:16:21] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=46293&edit=1