1

İ can export json data to excel with PHP. But I use ə,ü,ç,ı,ö and so on. This caracters don`t show. My code:

$file = "website_data_" . date('Ymd') . ".xls";
header("Content-Disposition: attachment; filename=\"$file\"");
header("Content-Type: application/vnd.ms-excel;   ");
$flag = false;
foreach($output as $row) {
  if(!$flag) { 
    $arr =  implode("\t", array_keys($row)) . "\r\n";
    $flag = true;
   }
   array_walk($row, __NAMESPACE__ . '\cleanData');
   $arr = $arr.implode("\t", array_values($row)) . "\r\n";
  }  
  echo   $arr; 

example

Help me please

Markus Zeller
  • 8,516
  • 2
  • 29
  • 35
Proq
  • 11
  • 4
  • This might be a dupe.... checkout https://stackoverflow.com/questions/6058394/unicode-character-in-php-string – Patrick Apr 22 '20 at 16:26

1 Answers1

0

Change the header to

header('Content-Type: application/vnd.ms-excel; charset=utf-8');

to enforce using the UTF-8 character set.

When this does not work, please show what your filter does.

Markus Zeller
  • 8,516
  • 2
  • 29
  • 35