On Wed, 21 Nov 2012 03:24:01 -0800, danielk wrote:

>> >>> import sys
>> >>> sys.stdout.encoding
>> 'cp437'
>
> Hmmm. So THAT'S why I am only able to use 'cp437'. I had (mistakenly)
> thought that I could just indicate whatever encoding I wanted, as long as
> the codec supported it.

sys.stdout.encoding determines how Python converts unicode characters
written to sys.stdout to bytes.

If you want the correct characters to be shown, this has to match the
encoding which the console window uses to convert those bytes back to
unicode characters.

You can tell Python to use whichever encoding you want, but often you only
get to control one side of the equation, in which case there's only one
"right" answer.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to