Message41194
This patch extends the set of Unicode strings that can
be printed to sys.stdout, to support all strings that
the terminal will likely support. It also adds an
encoding attribute to sys.std{in,out}.
To do that:
- it adds a .encoding attribute to all file objects,
which is normally None
- initializes the encoding of sys.stdin and sys.stdout
if either is a terminal.
- adds a wrapper object around sys.stdout in site.py
that encodes all Unicode objects according to the
detected encoding, if that encoding is known to Python
To find the encoding of the terminal, it
- uses GetConsoleCP and GetConsoleOutputCP on Windows,
- uses nl_langinfo(CODESET) on Unix, if available.
The primary rationale for this change is that people
should be able to print Unicode in an interactive
session. A parallel change needs to be added for IDLE,
so that it adds the .encoding attribute to the emulated
stdout (it already supports printing of Unicode on stdout). |
|
Date |
User |
Action |
Args |
2007-08-23 15:15:25 | admin | link | issue612627 messages |
2007-08-23 15:15:25 | admin | create | |
|