I'm having trouble exporting CSV data that has non-latin characters.
I am exporting the data as a CSV file using the following headers and PHP code:
header("Content-type: text/csv; charset=utf-8");
header("Content-Disposition: attachment; filename=myFile.csv");
header("Pragma: no-cache");
header("Expires: 0");
echo "First Name,Last Name, Email Address\n";
foreach ($users as $user) {
echo "{$user['first_name']},{$user['last_name']},{$user['email']}\n";
}
On Microsoft Excel, Since my data contains non-latin chars (Hebrew) I am seeing a scrambled data like this:
This issue doesn't exists on LibreOffice. any ideas how can I make MS-Excel open the file correctly?