Reading Windows CSV file with LCID entries under Linux.

skip at pobox.com skip at pobox.com
Mon Sep 22 11:35:26 EDT 2008


    Thomas> My question is: How can I convert this data into something more
    Thomas> reasonable like unicode? Basically, what I want is something
    Thomas> like "Text1;Text2", both fields encoded as UTF-8. Can this be
    Thomas> done with Python? How can I find out which codepage I have to
    Thomas> use for 1033 and 1031?

There are examples at end of the CSV module documentation which show how to
create Unicode readers and writers.  You can extend the UnicodeReader class
to peek at the LCID field and save the corresponding codepage for the
remainder of the line.  (This would assume you're not creating CSV files
which contain newlines.  Each line read would be assumed to be a new record
in the file.)

Skip



More information about the Python-list mailing list