[New-bugs-announce] [issue25863] ISO-2022 seeking forgets state

Martin Panter report at bugs.python.org
Mon Dec 14 21:37:24 EST 2015


New submission from Martin Panter:

>>> from io import *
>>> text = TextIOWrapper(BytesIO(), "iso-2022-jp")
>>> text.write(u"P")
1
>>> text.tell()
1
>>> text.write(u"anter 正")
7
>>> text.tell()
12
>>> text.write(u"孝")
1
>>> text.seek(12)
12
>>> text.read()  # Should return 孝, not ASCII
"9'"
>>> text.buffer.getvalue()
b"Panter \x1b$B at 59'"
>>> text.seek(1)
1
>>> text.read(7)
'anter 正'
>>> text.tell()  # Another bug?
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'iso2022_jp' codec can't decode bytes in position 2-3: illegal multibyte sequence

----------
components: IO, Unicode
messages: 256431
nosy: ezio.melotti, haypo, martin.panter
priority: normal
severity: normal
status: open
title: ISO-2022 seeking forgets state
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

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


More information about the New-bugs-announce mailing list