On Tue, May 20, 2008 at 10:41 AM, M.-A. Lemburg <mal@egenix.com> wrote:
On 2008-05-20 10:22, Martin v. Löwis wrote:
I'd like to propose a new environment variable PYTHONSTDOUTENCODING.
This is meant to solve various problems that people had with Python
not detecting their terminal encoding correctly; it would override
any detection that Python would use for determining the encoding of
stdout (and stdin - but that's less relevant in 2.x).

How is this relevant for 2.x ?

In 2.x, stdin and stdout are just files without any io wrappers
around them.

Writing Unicode to stdout will still use the default encoding
ASCII to convert it to an 8-bit string. All other 8-bit strings
will be passed to stdout as-is.

You're forgetting about print; in Python 2.x, when stdout is connected to a terminal, the locale settings (typically the LANG, LC_ALL and LC_CTYPE environment variables) are taken into account when 'print' writes to sys.stdout.

--
Thomas Wouters <thomas@python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!