Microsoft Excel mangles Diacritics in .csv files?

后端 未结 22 2269
粉色の甜心
粉色の甜心 2020-11-22 05:02

I am programmatically exporting data (using PHP 5.2) into a .csv test file.
Example data: Numéro 1 (note the accented e). The data is utf-8 (

22条回答
  •  青春惊慌失措
    2020-11-22 05:34

    UTF-8 doesn't work for me in office 2007 without any service pack, with or without BOM (U+ffef or 0xEF,0xBB,0xBF , neither works) installing sp3 makes UTF-8 work when 0xEF,0xBB,0xBF BOM is prepended.

    UTF-16 works when encoding in python using "utf-16-le" with a 0xff 0xef BOM prepended, and using tab as seperator. I had to manually write out the BOM, and then use "utf-16-le" rather then "utf-16", otherwise each encode() prepended the BOM to every row written out which appeared as garbage on the first column of the second line and after.

    can't tell whether UTF-16 would work without any sp installed, since I can't go back now. sigh

    This is on windows, dunno about office for MAC.

    for both working cases, the import works when launching a download directly from the browser and the text import wizard doesn't intervence, it works like you would expect.

提交回复
热议问题