[issue4862] utf-16 BOM is not skipped after seek(0)

Antoine Pitrou report at bugs.python.org
Wed Jan 7 13:59:01 CET 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

Well, there are other problems with utf-16, e.g. when opening an
existing file for appending, the BOM is written again:

>>> f = open('utf16.txt', 'w', encoding='utf-16')
>>> f.write('abc')
3
>>> f.close()
>>> f = open('utf16.txt', 'a', encoding='utf-16')
>>> f.write('def')
3
>>> f.close()
>>> open('utf16.txt', 'r', encoding='utf-16').read()
'abc\ufeffdef'


Who said TextIOWrapper was sane? :-o

----------
nosy: +pitrou

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


More information about the Python-bugs-list mailing list