title: exporting php output as excel
body: <pre><code>include_once 'mysqlconn.php';
  include_once "functions.php";
  $filename = $_GET['par'].".xls";
  header("Content-type: application/x-msexcel"); 
  header('Content-Disposition: attachment; filename="'.basename($filename).'"'); 
  if ($_GET['i'] == "par1") {
    func1();
  } else if ($_GET['i'] == "par2") {
    echo "şşşıııİİİ";
    func2();  
  } else if ($_GET['i'] == "par3") {  
    echo "şşşıııİİİ";
    func3();  
  } 
  </code></pre>
  
  <p>this is my export2excel.php file and func1,2,3 are in functions.php file and produces table output all work well except character encoding in a strange way. I am using utf-8 encoding for all my files. 2nd else if statement above produces healthy encoded output but rest 2 are encodes my output with strange characters like "BÃœTÃ‡E Ä°Ã‡Ä°". it is "BÜTÇE İÇİ" in turkish.</p>
  
  <p>in short. same files, same encoding, same database but different results.</p>
  
  <p>any idea?</p>