Req #46293 [Fbk->NoF]: imagettftext() function doesn't handle UTF-8 encoded strings

From: Date: Sun, 29 Jan 2017 04:22:49 +0000
Subject: Req #46293 [Fbk->NoF]: imagettftext() function doesn't handle UTF-8 encoded strings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207025@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: php-bugs@lists.php.net Reported by: php at ibeni dot net Summary: imagettftext() function doesn't handle UTF-8 encoded strings -Status: Feedback +Status: No Feedback Type: Feature/Change Request Package: GD related Operating System: FreeBSD c1 6.3-RELEASE PHP Version: 5.2.6 Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2017-01-18 17:05:52] cmb@php.net Does this issue still persist with current PHP/GD versions? ------------------------------------------------------------------------ [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

« previous php.bugs (#207025) next »