Re: Re: imagettftext and utf-8 (swedish characters)

From: Date: Fri, 29 Feb 2008 23:10:42 +0000
Subject: Re: Re: imagettftext and utf-8 (swedish characters)
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-270785@lists.php.net to get a copy of this message
Frank Arensmeier skrev:
29 feb 2008 kl. 03.41 skrev David Sveningsson:
Nathan Rixham skrev:
before going any further, your HTML page is in UTF-8 yes? with the appropriate content-type line.
Yes, apache uses only utf-8 as charset and the html content-type meta tag is set to utf-8 too. Also, the html form validates at validator.w3.org
plus: first debugging step: function preview(){ $title = html_entity_decode($_GET['title'], ENT_COMPAT, 'UTF-8'); print_r($title); #verify in view source / web browser that data is correct before it's sent to imagettftext
I see the characters correctly, and page info in firefox says the encoding is utf-8.
From the man page: "If a character is used in the string which is not supported by the font, a hollow rectangle will replace the character."... If you are 100% sure that the var $title contains a valid UTF-8 encoded text sting (simply output the string to the browser and set the page encoding to UTF-8), then the only thing that is left that might screw up the text-to-image output is the font you are using. As you might know, you can only use TrueType fonts.
I am quite sure that the font supports the characters. I tried a couple of fonts that I use in other programs with utf-8. I am, however, not 100% sure that $title is correct utf-8, but I think it is.

« previous php.general (#270785) next »