2
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

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.