This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients georg.brandl, jaywalker, jdwhitley, pitrou, sjmachin, skip.montanaro, vstinner
Date 2009-03-09.14:14:09
SpamBayes Score 4.764406e-08
Marked as misclassified No
Message-id <18869.9260.483123.721911@montanaro.dyndns.org>
In-reply-to <1236595224.8096.6.camel@fsol>
Content
Antoine> However, I think csv should accept files opened in binary mode
    Antoine> and be able to deal with line endings itself. How am I supposed
    Antoine> to know the encoding of a CSV file? Surely Excel uses a
    Antoine> defined, default encoding when exporting to CSV... that
    Antoine> knowledge should be embedded in the csv module.

In fact, the csv module actually requires files to be opened in binary mode
but doesn't enforce that.  That it works in all but a few corner cases is
because so few CSV files contain fields containing embedded newlines.

Why doesn't open() allow you to specify an encoding when opening in binary
mode?  Even though it would be unused by the File object, it would serve as
an annotation for code using that open File object so they can do the
appropriate bytes-to-unicode conversion.

Skip
History
Date User Action Args
2009-03-09 14:14:12skip.montanarosetrecipients: + skip.montanaro, georg.brandl, sjmachin, pitrou, vstinner, jaywalker, jdwhitley
2009-03-09 14:14:11skip.montanarolinkissue4847 messages
2009-03-09 14:14:09skip.montanarocreate