[Python-Dev] CSV, bytes and encodings
skip at pobox.com
skip at pobox.com
Wed Apr 1 14:51:28 CEST 2009
Antoine> Perhaps. But without using 'rU' the file couldn't be read at
Antoine> all. (I'm not sure it was Windows line endings by the way;
Antoine> perhaps Macintosh ones; anyway, it didn't work using 'rb')
Please file a bug report and assign to me. Does it work in 2.x? What was
the source of the file?
Antoine> I have to add that if individual fields really can contain
Antoine> newlines, then the CSV module ought to be smarter when /saving/
Antoine> those fields. I've inadvertently tried to produce a CSV file
Antoine> with such fields and it ended up wrong when opened as a
Antoine> spreadsheet (text after the newlines was ignored in Gnumeric
Antoine> and in OpenOffice, while Excel displayed a spurious additional
Antoine> row containing only the text after the newline).
Sounds like you have a budding test case.
Of course, the problem with CSV files is that there is no standard. In the
above paragraph you named three. The CSV authors chose Excel's behavior as
the measuring stick. Still, that's not written down anywhere. You have to
read the tea leaves.
Skip
More information about the Python-Dev
mailing list