Hi,
I think you can solve the problem by replacing the character with its numeric entity. The gd library supports numeric entities instead of encoding dependent characters.
Something like this should work (if the mbstring extension is enabled):
<?php
// Set the content-type
header("Content-type: image/png");
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
$text = mb_encode_numericentity(" ’ ", array(0x80, 0xff, 0, 0xff), 'utf-8');
// or without mbsting: $text = " & #180; ";
// Replace path by your own font path
$font = 'arial.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
You may need to adjust the third mb_encode_numericentity argument (encoding) to the encoding of the php file (or the text).
The numeric entity of the right quote is & #180;
(remove the space between the ampersand and the #)
Regards,
Thomas