Benjamin Kaplan <benjamin.kap...@case.edu> writes: > Sys.stdin and stdout are files, just like any other. There's nothing > special about them at compile time. When the interpreter starts, it > checks to see if they are ttys. If they are, then it tries to figure > out the terminal's encoding based on the environment.
Just a related question, is looking at sys.stdin.encoding the proper way of doing things? I've been working on a script to display some email headers, some of which are encoded in MIME to various charsets. Until now I have used whatever locale.getdefaultlocale() returns as the target encoding, since "it seemed to work". Although on one computer the call returns ISO-8859-15 even though I don't quite understand why. -- http://mail.python.org/mailman/listinfo/python-list