[New-bugs-announce] [issue6268] Seeking to the beginning of a text file a second time will return the BOM as first character

Mark Florisson report at bugs.python.org
Thu Jun 11 20:26:43 CEST 2009


New submission from Mark Florisson <markflorisson88 at gmail.com>:

>>> f = open('foo', 'wt+', encoding='UTF-16')
>>> f.write('spam ham eggs')
13
>>> f.seek(0)
0
>>> f.read()
'spam ham eggs'
>>> f.seek(0)
0
>>> f.read()
'\ufeffspam ham eggs'

Although the BOM character is a ZERO WIDTH NO-BREAK SPACE, and should
therefore not impose many problems, the behavior is inconsistent and
unexpected.
codecs.open in 2.x suffers from this same behavior.

----------
components: Unicode
messages: 89257
nosy: eggy
severity: normal
status: open
title: Seeking to the beginning of a text file a second time will return the BOM as first character
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2

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


More information about the New-bugs-announce mailing list