Excel needs to know that you are using non-ASCII characters in your CSV or it will not display them correctly :)
Add the BOM(Byte Order Mark) to the first line, notifying Excel that you are offering a UTF-8 encoded file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
//headers header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Description: File Transfer'); header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename=your.csv;'); header('Content-Transfer-Encoding: binary'); //open file pointer to standard output $fp = fopen('php://output', 'w'); //add BOM to fix UTF-8 in Excel fputs($fp, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF) )); |