Answer the question
In order to leave comments, you need to log in
Correct csv export to utf-8 with BOM
You need to export data from the database to open it in excel.
I create csv where separator is the \t sign.
The encoding in the base is utf-8, in php it is also utf-8, when exporting I use the following headers:
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-Disposition: attachment; filename=".$dt.".xls");
header("Pragma: no-cache");
Answer the question
In order to leave comments, you need to log in
I have everything correctly Excel determines. I use a semicolon separator and insert BOM before writing to .csv:
$csv = fopen('file.csv', 'w');
fprintf($csv, chr(0xEF).chr(0xBB).chr(0xBF));
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question