[Python-Dev] PEP 263 in the works (Non-ASCII characters in test_pep277.py in 2.3)

Martin v. Loewis martin@v.loewis.de
07 Oct 2002 19:57:31 +0200


Guido van Rossum <guido@python.org> writes:

> Or it suggests that we need a way to deal with encodings on stdout
> more gently.

See python.org/sf/612627. With that patch, MAL should be able to do

print u

and get it out correctly no matter what terminal encoding the user
uses (assuming the user follows system conventions).

It would also allow to do

print s.decode("utf-8").encode(sys.stdout.encoding)

Either would work as long as sys.stdout is a terminal, which should
include IDLE interactive sys.stdout. It is debatable whether this
should work for interactive mode only, or for all scripts.

Regards,
Martin