[issue3025] batch/IDLE differ: print broken for chraracters>ascii

Jim Jewett report at bugs.python.org
Mon Jun 2 01:12:29 CEST 2008


New submission from Jim Jewett <jimjjewett at users.sourceforge.net>:

The str->Unicode change widened IDLE/batch discrepancy.

In python 2.x, bytes are printable.

>>> for i in range(256): print i, chr(i)

works fine.  In python 3, chr has become (the old) unichr, and whether a 
unicode character is printable depends on the environment.  In particular, 
under my Windows XP, the equivalent

>>> for i in range(256): print (i, chr(i))

will still work fine under IDLE, but will now crash with an 
UnicodeEncodeError when run from the command line.

----------------

Unfortunately, I'm not sure what the right solution actually is, other than 
a mention in the Whats New document.  

I believe the 2.5 code was using a system page to print those characters, as 
they often looked like letters rather than <control>.  Copying that would 
probably be the wrong solution.

Limiting IDLE would add consistency, but might be a lot of work for the 
equivalent of a --pedantic flag.

PEP 3138 seems to be proposing a default stdout BackslashReplace, which may 
at least  help.

----------
assignee: georg.brandl
components: Documentation, Unicode
messages: 67617
nosy: georg.brandl, jimjjewett
severity: normal
status: open
title: batch/IDLE differ: print broken for chraracters>ascii
type: behavior
versions: Python 3.0

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


More information about the Python-bugs-list mailing list