This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ned.deily
Recipients Tomoki.Imai, ezio.melotti, ned.deily, pradyunsg, r.david.murray, roger.serwy, terry.reedy
Date 2013-04-22.04:41:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1366605711.79.0.327802857531.issue17348@psf.upfronthosting.co.za>
In-reply-to
Content
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 of Tk's support of non-BMP characters; because of that, it may not possible to fully mimic the interactive interpreter.
History
Date User Action Args
2013-04-22 04:50:19ned.deilyunlinkissue17348 messages
2013-04-22 04:41:51ned.deilysetrecipients: + ned.deily, terry.reedy, ezio.melotti, roger.serwy, r.david.murray, pradyunsg, Tomoki.Imai
2013-04-22 04:41:51ned.deilysetmessageid: <1366605711.79.0.327802857531.issue17348@psf.upfronthosting.co.za>
2013-04-22 04:41:51ned.deilylinkissue17348 messages
2013-04-22 04:41:51ned.deilycreate