I'm generating csv file but it save as "UTF-8 without BOM"
how can I save as "UTF-8 with BOM" ?
I'm using following header in codeigniter
header('Content-Type: text/csv;charset=utf-8');
I'm generating csv file but it save as "UTF-8 without BOM"
how can I save as "UTF-8 with BOM" ?
I'm using following header in codeigniter
header('Content-Type: text/csv;charset=utf-8');
This is already a duplicate of How can I output a UTF-8 CSV in PHP that Excel will read properly?
However you need to include a Byte Order Mark. This can be done in this way: https://stackoverflow.com/a/7601168/678611
<?php
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=<a filename>.csv');
header('Content-Transfer-Encoding: binary');
echo "\xEF\xBB\xBF"; // Byte Order Mark
echo $the_csv_file_content;
exit();
?>