Solution to Excel 2003 and CSV with unicode (UTF-8) problem

It was real pain to make Excel 2003 correctly show Unicode characters in generated CSV, giving charset=UTF-8 hint did not work and it seemed like nobody knew the solution online – the salvation is here however (PHP here):

// echo UTF-8 file format sign: otherwise Excel won’t convert UTF data
echo chr(0xEF);
echo chr(0xBB);
echo chr(0xBF);

// actual CSV here

Excel 2003 (with SP3 – maybe older versions won’t work, Excel 97 certainly doesn’t) suddenly became Unicode aware: please comment on your experience if this fix worked for you.

Leave a Reply