print and unicode strings

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Wed Feb 20 03:25:55 EST 2002


martin at v.loewis.de (Martin v. Loewis) wrote:

>"Jason Orendorff" <jason at jorendorff.com> writes:
>
>> I think IDLE should do this by default.  It's fine for
>> Python to "refuse to guess" encodings, but in the case of Tk
>> it's UTF-8 on all platforms... right?
>
>Well, not exactly. Tkinter supports Unicode strings as primary data
>type for text, with byte strings (e.g. UTF-8) only being the second
>choice. So IDLE should set sys.stdout to a stream that accepts Unicode
>objects as-is.

That still wont fly, because 'print' always passes the to-be-printed
objects through str() before calling file.write()

Here is a patch (now sadly rejected) that I used for a while:

http://sourceforge.net/tracker/?group_id=5470&atid=305470&func=detail&aid=403685



Toby Dickenson
tdickenson at geminidataloggers.com



More information about the Python-list mailing list