Ned Deily added the comment:

I think this is another case where confusion is introduced by the behavior of 
Python 2 interactive mode with regard to encodings.  In 2.x Python/pythonrun.c, 
depending on a number of factors the interactive loop will try to set a more 
useful encoding on stdin, stdout, and stderr for any of them assigned to a 
terminal (isatty)  This is why the examples using the interpreter (not IDLE) 
work when the locale env variables (LANG, et al) are set to one that supports 
Unicode (like "en_US.utf8").  If you changed them to a non-Unicode locale (like 
"C") and ran the interpreter examples, they wouldn't work.  Even clearer, if 
you used a Unicode-aware text editor to write the examples to files without a  
# -*- coding: utf-8 -*- directive and tried to run them with 
/usr/bin/python2.7, you'd get a syntax error.  I suspect the issue here is that 
2.x IDLE PyShell does not exactly mimic the behavior of the interpreter 
interactive loop about setting encodings for std*.  A side issue is the 
limitation o
 f Tk's support of non-BMP characters; because of that, it may not possible to 
fully mimic the interactive interpreter.

----------
nosy: +ned.deily

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

Reply via email to