[Python-Dev] IDLE and non-ASCII characters (original) (raw)

Guido van Rossum guido@digicool.com
Sun, 13 May 2001 17:51:17 -0500


Thanks to a bug report I got, I noticed for the first time that you cannot enter non-ASCII characters in IDLE anymore. Eg. at the shell prompt, you may get

>>> s='��' UnicodeError: ASCII encoding error: ordinal not in range(128)

This doesn't bother me, because I don't know how to enter such characters with my US keyboard anyway. :-) :-)

Likewise, when trying to save a file that has non-ASCII characters, you get a traceback.

Yes, this has bitten me once. It was very painful (I lost a few hours worth of writing).

In other words, I agree it's a problem!

Now, I think I understand all the causes of the problem (Tkinter returning Unicode objects, and so on). However, I'm curious whether anybody has proposals on how to deal with it.

Not me -- unfortunately, there are too many alternatives to IDLE to be able to justify working on it much.

For saving text files, if Python had an encoding directive, things might be easier :-) For the shell prompt, I've no idea how to solve this best.

So any suggestions are welcome.

Ditto.

Postscript: using cut and paste, I can enter "s='��'" in IDLE at the Python prompt, both on Linux and on Windows 98. It prints as '\xe4\xf6' on both systems. What changed?

--Guido van Rossum (home page: http://www.python.org/~guido/)