[issue7651] Python3: guess text file charset using the BOM

STINNER Victor report at bugs.python.org
Fri Jan 8 11:23:48 CET 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

New version of the patch which is shorter, cleaner, fix the last bug (seek) and don't change the default behaviour anymore (checking for BOM is now explicit):
 * BOM checking is now optional (explicit): use open(filename, encoding="BOM"). open(filename, "w", encoding="BOM") raises a ValueError.
 * Create a BOMS dictionary directly in the codecs module
 * Fix TextIOWrapper for seek(0) (add _has_bom attribute)
 * Add an unit test for read() and readlines()
 * Read the encoding property before the first read gives None

I also removed the _get_encoding() method (hack).

----------
Added file: http://bugs.python.org/file15786/open_bom-3.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7651>
_______________________________________


More information about the Python-bugs-list mailing list