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

Lennart Regebro regebro at gmail.com
Sat Jan 9 23:14:08 CET 2010

On Sat, Jan 9, 2010 at 21:28, Antoine Pitrou <solipsis at pitrou.net> wrote:
> If we want it to be the default, it must be able to fallback on the current
> locale-based algorithm if no BOM is found. I don't think it would be easy for a
> codec to do that.

Right. It seems like encoding=None is the right way to go there.
encoding='BOM' would probably only work if 'BOM' isn't an encoding but
a special tag, which is ugly.

Lennart Regebro: Python, Zope, Plone, Grok
+33 661 58 14 64

More information about the Python-Dev mailing list