title: PHP - Convert Unicode for CSV, e.g. chinese characters
body: <p>with a form post we pass the data to a PHP script that creates a downloadable CSV for spread sheet programs (e.g. excel).
  The scipt below works perfect if no special char are passed. but passing special chars like chinese letters ends in the unicode....</p>
  
  <p>Example:
  we send "你好世界" (hello world, unicode: &amp;#20320;&amp;#22909;&amp;#19990;&amp;#30028;) via a form field post to this php script export.php</p>
  
  <pre><code>&lt;?php //opens a download dialog, download by excel
  header("Content-type: text/csv; charset=UTF-8");
  header("Content-Disposition: attachment; filename=\"eCalc Results.csv\"");
  echo html_entity_decode(urldecode($_POST["exportData"])); 
  // returns unicode &amp;#20320;&amp;#22909;&amp;#19990;&amp;#30028;
  ?&gt;
  </code></pre>
  
  <p>How can we convert this unicodes for CSV that the chinese letters are shown again correcly as 你好世界...?</p>
  
  <p>here the example: <a href="http://s4a.ch/exporttest/hello.php" rel="nofollow">http://s4a.ch/exporttest/hello.php</a></p>
  
  <p>we searched the entire stackoverflow, but no conversion was successfull...</p>
  
  <p>thanks for your help
  eCalc</p>