[Python-Dev] Improve open() to support reading file starting with an unicode BOM

Lennart Regebro regebro at gmail.com
Mon Jan 11 14:47:12 CET 2010


On Mon, Jan 11, 2010 at 14:21, Walter Dörwald <walter at livinglogic.de> wrote:
> I think we already had this discussion two years ago in the context of
> XML decoding ;):

Yup. Ans Martins answer then is my answer now:

"> So the code is good, if it is inside an XML parser, and it's bad if it
> is inside a codec?

Exactly so. This functionality just *isn't* a codec - there is no
encoding. Instead, it is an algorithm for *detecting* an encoding."

The conclusion was that a method do autodetect encodings would be
good. I think the same conclusion applies here.

-- 
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64



More information about the Python-Dev mailing list