php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49153 combining characters in UTF-8 doesn't seem to work
Submitted: 2009-08-04 14:05 UTC Modified: 2009-08-06 13:29 UTC
From: andy at bdnews24 dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.2.10 OS: Win Server 2003 Enterprise SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andy at bdnews24 dot com
New email:
PHP Version: OS:

 

 [2009-08-04 14:05 UTC] andy at bdnews24 dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-06 13:29 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #34670
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 18:01:31 2024 UTC