[Python-Dev] PEP 263 considered faulty (for some Japanese)

Martin v. Loewis martin@v.loewis.de
12 Mar 2002 22:05:00 +0100


"Samuele Pedroni" <pedroni@inf.ethz.ch> writes:

> In Jython we have such an encoding that can be set with the -E codec
> flag or a registry option (the moral equivalent of env var for CPython
> settings),  at the moment AFAIK it is is only used for the interactive prompt
> input, whereas you presumably intented a default encoding for sys.stdin/out.

Indeed. I would check whether sys.stdout isatty() before applying the
encoding. In the Windows (NT) console window, MS has special API to
output Unicode, on other systems, the console encoding would be used.

For sys.stdin, it would never be used, but just exposed to the
application for converting input if it wants Unicode. The only
exception might be raw_input(): In IDLE, raw_input() will natively
return Unicode strings; I'm not sure whether IDLE should attempt to
convert them to byte strings, or whether it should return Unicode
strings from raw_input().

Regards,
Martin