[Python-Dev] Improve open() to support reading file starting with an unicode BOM
victor.stinner at haypocalc.com
Fri Jan 8 10:08:30 CET 2010
Le vendredi 08 janvier 2010 03:23:08, MRAB a écrit :
> Guido van Rossum wrote:
> > I'm a little hesitant about this. First of all, UTF-8 + BOM is crazy
> > talk. And for the other two, perhaps it would make more sense to have
> > a separate encoding-guessing function that takes a binary stream and
> > returns a text stream wrapping it with the proper encoding?
> Alternatively, have a universal UTF-8/16/32 encoding, ie one that
> expects UTF-8,
> with or without BOM, or UTF-16/32 with BOM.
Do you mean open(filename, encoding="BOM")? I suppose that "BOM" would be a
magical value specific to read a text file (open(filename, "r")), not a real
Otherwise which encoding should be used for open(filename, "w",
More information about the Python-Dev