New submission from Atsuo Ishimoto <ishim...@gembook.org>:

In Python 3(both 3.0.1 and SVN repo), if I set 
PYTHONIOENCODING=ShiftJIS:backslashreplace, print()
outputs wrong result.

>>> print("\xff")
\xff\xff

Obviously, '\xff' should be printed instead of '\xff\xff'.

Following is what io module does to print string.

>>> import codecs
>>> e=codecs.getincrementalencoder("ShiftJIS")("backslashreplace")
>>> e.encode("\xff")
b'\\xff'
>>> e.encode("\n")
b'\\xff\n'

io module never supply final=True to the encoder.

----------
components: Unicode
messages: 84987
nosy: ishimoto
severity: normal
status: open
title: Wrong print() result when unicode error handler is not 'strict'
type: behavior
versions: Python 3.0, Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5640>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to