getting data with proper encoding to the finish

Serge Orlov Serge.Orlov at gmail.com
Wed Mar 16 06:31:08 EST 2005


Ksenia Marasanova wrote:
> John, Serge, thanks for your help!
>
> utf-16le  encoding didn't help. I had however to solve it yesterday,
> so I used csv module to create CSV file and then import it in Excel.
> Excel still had troubles with accented characters, but this is
another
> story: it seems that Office 2004 Excel (for Mac, but I assume the PC
> version is no better) cannot import UTF-8 encoded text files.

Right, I tried on windows xp, utf-8 csv file is imported as garbadge.
However, csv file saved in utf-16 encoding is imported correctly.

> Encoding
> CSV file with Latin1 encoding finally did work.
>
> Now back to the Excel story, I also think that there is something
> wrong with pyExcelWriter or the way I use it. CSV file generation was
> okay, so I think there is nothing wrong with my data,  or XML parser.
>
> I will resume in a few days with pyExcelWriter and will post the
> results here, but anyway, many thanks for your time and explanation!

I believe Microsoft Office has gone through byte strings to unicode
strings transformation between 1995 and 1997. I still remember times
when you could receive Microsoft Office file and couldn't view it.
I suspect pyExcelWriter writes strings in that old format so utf-16le
trick didn't work. You can try to contact pyExcelWriter author
and ask him about unicode support.

  Serge.




More information about the Python-list mailing list