Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
setlocale(LC_MONETARY, 'en_GB.UTF-8');
imagestring( $my_img, 4, $colC, $row1, money_format('%(#5n', $rates[0][0]), $text_colour );

...
...
...

header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $line_colour );
imagecolordeallocate( $text_colour );
imagecolordeallocate( $background );
imagedestroy( $my_img );

Everything works fine, however I have a strange error...

The currency symbol looks wrong. Instead of showing a £ sign, it shows an A with a caret on top and what looks like the bottom half of a pound sign.

So I tried to remove the .UTF-8 and the A with a caret disappears but it still only shows the bottom half of the pound sign.

What I want, is simply a £ sign. Can anybody help please???

PHP Error

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

According to the documentation, imagestring only supports Latin2 in the default font, which cannot encode £. Even if it could encode £, you should have converted your UTF-8 to Latin2 before passing it.

Use imageTtfText which supports UTF-8. You need to point it to a working TrueType font file in the 7th argument.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.