gd, utf8, umlaut problem

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
rmrts
Forum Newbie
Posts: 1
Joined: Thu Oct 18, 2007 9:22 am

gd, utf8, umlaut problem

Post by rmrts »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hello,

i want to create an image from an result of an mysql query (table and database is utf8, the text in the field is "_üöä__") with gd and php.
The result of the query seems to me to be utf8 : an " echo chunk_split(bin2hex($text1), 2, ' ');" gives " 5f c3 bc c3 b6 c3 a4 5f 5f " in the browser.
I think this will be correct.

Now i want to make an image with this output:
i use :
....

Code: Select all

$font="Arial.ttf";


$im = imagecreate (1810, 100);
$white = imagecolorallocate ($im, 255, 255, 255);
$black = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle($im,0,0,609,99,$white);
imagettftext ($im, 30, 0, 10, 40, $black, $font, $text1);
header ("Content-type: image/png");
imagepng ($im);
imagedestroy($im);
where $text is the result of the mysql-query


But there are no " üöä " in the image, just squares, the "_" is correct.

Can anyone help?

I use :
NetBSD 3.1
PHP 4.4.7 (cli)
gd-2.0.34
php4-gd-4.4.7 PHP extension for GD graphics library
freetype2-2.3.4nb1
freetype-lib-1.5
freetype-utils-1.5
freetype-1.5

The software is build from the sources of pkgsrc from netbsd (netbsd.org).

Best Regards
Reinhold


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply