title: How do I export a table that contains Hindi text into Excel using php?
body: <p>I am trying to export Hindi data into excel using php. After having exported the Hindi data, it is shown in different format "????????? ????". My previous code is </p>
  
  <pre><code>&lt;?php
  include 'config.php';
  setlocale(LC_ALL, "en_US.UTF-8");
  $DB_TBLName = "feedback"; //MySQL Table Name   
  $filename = "feedback";         //File Name
  /*******YOU DO NOT NEED TO EDIT ANYTHING BELOW THIS LINE*******/    
  //create MySQL connection   
  $sql = "Select * from $DB_TBLName";
  $Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password) or die("Couldn't connect to MySQL:&lt;br&gt;" . mysql_error() . "&lt;br&gt;" . mysql_errno());
  //select database   
  $Db = @mysql_select_db($DB_DBName, $Connect) or die("Couldn't select database:&lt;br&gt;" . mysql_error(). "&lt;br&gt;" . mysql_errno()); 
  
  //execute query 
  
  $result = @mysql_query($sql,$Connect) or die("Couldn't execute query:&lt;br&gt;" . mysql_error(). "&lt;br&gt;" . mysql_errno()); 
  $file_ending = "xls";
  
  //setlocale(LC_ALL, "en_US.UTF-8");
  
  //$result=mb_convert_encoding($result, 'ISO-8859-13','UTF-8');
  
  /*******Start of Formatting for Excel*******/   
  //define separator (defines columns in excel &amp; tabs in word)
  $sep = "\t"; //tabbed character
  //start of printing column names as names of MySQL fields
  for ($i = 0; $i &lt; mysql_num_fields($result); $i++) {
  echo mysql_field_name($result,$i) . "\t";
  
  }
  
  print("\n");    
  //end of printing column names  
  //start while loop to get data
      while($row = mysql_fetch_row($result))
      {
          $schema_insert = "";
          for($j=0; $j&lt;mysql_num_fields($result);$j++)
          {
                  if(!isset($row[$j]))
                  $schema_insert .= "NULL".$sep;
              elseif ($row[$j] != "")
                  $schema_insert .= "$row[$j]".$sep;
              else
                  $schema_insert .= "".$sep;
          }
          $schema_insert = str_replace($sep."$", "", $schema_insert);
          $schema_insert = preg_replace("/\r\n|\n\r|\n|\r/", " ", $schema_insert);
          $schema_insert .= "\t";
          print(trim($schema_insert));
          print "\n";
      } 
  
  
      //header info for browser
  
      header("Content-Type: application/vnd-ms-excel");
      header("Content-Disposition: attachment; filename=$filename.xls");  
      header("Pragma: no-cache"); 
      header("Expires: 0");
  
  ?&gt;
  </code></pre>
  
  <p>After doing some research somebody suggested to add a charset before fetching data from table. And I added the line <code>mysql_set_charser('utf-8')</code>. Now it is exporting in different format <strong>à¤£à¤¾à¤šà¤¬à¥‚à¤›à¤ à¤›à¤¤à¤®</strong>, but I am not getting it in Hindi.</p>
  
  <p>Thanks.</p>