Message187547
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. |
|
Date |
User |
Action |
Args |
2013-04-22 04:50:19 | ned.deily | unlink | issue17348 messages |
2013-04-22 04:41:51 | ned.deily | set | recipients:
+ ned.deily, terry.reedy, ezio.melotti, roger.serwy, r.david.murray, pradyunsg, Tomoki.Imai |
2013-04-22 04:41:51 | ned.deily | set | messageid: <1366605711.79.0.327802857531.issue17348@psf.upfronthosting.co.za> |
2013-04-22 04:41:51 | ned.deily | link | issue17348 messages |
2013-04-22 04:41:51 | ned.deily | create | |
|