Encodings and printing unicode
Kent Johnson
kent37 at tds.net
Mon Mar 14 09:09:06 EST 2005
Fuzzyman wrote:
> How does the print statement decode unicode strings itis passed ? (By
> that I mean which encoding does it use).
sys.stdout.encoding
> Under windows it doesn't appear to use defaultencoding. On my system
> the default encoding is ascii, yet the terminal encoding is latin1 (or
> cp1252 or whatever, but not ascii). This means that print '£' works
> fine, yet unicode('£') will raise the UnicodeDecodeError.
This uses sys.defaultencoding
Kent
More information about the Python-list
mailing list