Answer the question
In order to leave comments, you need to log in
How to generate CSV in PHP that will be displayed correctly everywhere?
It seems to be a simple task to make CSV.
I create it with , then convert from UTF-8 to Windows-1251 with iconv. For most users, it opens correctly, you can immediately work with columns. But for many text fields - in krakozyabry. fputcsv($fp, $fields,";");
Answer the question
In order to leave comments, you need to log in
It's about the BOM
$fp = fopen('testcsv.csv', 'w');
fputs($fp, chr(0xEF) . chr(0xBB) . chr(0xBF)); // BOM
fputcsv($fp, array('Item', 'Столбец 1', 'Данные'), ';');
fclose($fp);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question