New submission from Mark Florisson <markflorisso...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue6268> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com