title: PHP 5: how to write utf-8 binary data - image - to output?
body: <p>I have a Ubuntu server and PHP5, and the PHP script files, and all output are in UTF-8.
  I'm trying to send an image to the output stream, but just garbled chinese characters shows up in the output:</p>
  
  <p><code>$im = imagecreatetruecolor(120, 20);<br>
  $text_color = imagecolorallocate($im, 233, 14, 91);<br>
  imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);<br>
  header('Content-type: image/jpeg');<br>
  imagejpeg($im);<br>
  imagedestroy($im);
  </code></p>
  
  <p>any suggestions?</p>