[Python-Dev] CSV, bytes and encodings

Antoine Pitrou solipsis at pitrou.net
Thu Apr 2 07:23:22 CEST 2009


Le mercredi 01 avril 2009 à 18:22 -0400, R. David Murray a écrit :
> I just added some tests to trunk that seem to indicate this case is
> handled correctly in terms of preserving the data.  Maybe you didn't
> write the file such that the fields with the newlines were quoted?

I used the default csv.writer into a StringIO, and the whole was then
returned as the response of an HTTP request (with the proper
Content-Type and Content-Disposition headers). I assume quoting is
enabled by default?

> And of course how non-Excel applications handle that data on import
> can be different from how Excel handles it.

Of course, but when three major spreadsheet software (including Excel
itself) choke on the embedded newline, there might be a problem (or
not :)).
(please note that as for Excel I couldn't test myself, a client of mine
did)

Regards

Antoine.




More information about the Python-Dev mailing list