[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

STINNER Victor report at bugs.python.org
Fri Mar 20 01:37:48 CET 2009


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

@pitrou: You're right, but the state have to be changed for the 
encoder, not the decoder. I added the following code to TextIOWrapper 
constructor (for the C and the Python version of io library):

        if self._seekable and self.writable():
            position = self.buffer.tell()
            if position != 0:
                self._encoder = self._get_encoder()
                self._encoder.setstate(0)

----------
keywords: +patch
Added file: http://bugs.python.org/file13377/append_bom.patch

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


More information about the Python-bugs-list mailing list