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

Guido van Rossum guido at python.org
Fri Jan 8 16:59:45 CET 2010


On Thu, Jan 7, 2010 at 10:12 PM, Tres Seaver <tseaver at palladion.com> wrote:
> The BOM should not be seekeable if the file is opened with the proposed
> "guess encoding from BOM" mode:  it isn't properly part of the stream at
> all in that case.

This feels about right to me. There are still questions though:
immediately after opening a file with a BOM, what should .tell()
return? And regardless of that, .seek(0) should put the file in that
same initial state.

-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list