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

Martin von Loewis loewis@informatik.hu-berlin.de
Mon, 14 May 2001 13:29:21 +0200 (MEST)


I have a bug report assigned to myself which indicates similar problems with tkinter and Tk/Tcl. There were other problem reports on the German Python mailing list going in the same direction too.

The basic problem seems to be that Tk/Tcl applies too much magic to the text widget contents in order to find out the used encoding and this can easily cause the whole encoding mechanism to fail.

This is actually a different problem. In this scenario here, the user types non-ASCII character into a text widget, then _tkinter returns a Unicode object (IMO rightfully so). In the other problem, the Python program puts a byte string into a text widget, the user enters some more characters, and _tkinter returns a byte string which does not follow any encoding.

A Tk/Tcl expert should really look into this and fix tkinter.c to aid Tk/Tcl in not mixing up the encodings (e.g. it would probably be a good idea to recode Python 8bit-strings into whatever encoding Tk/Tcl assumes as default).

Again, this is not the issue here: Both _tkinter and Tk behave absolutely correct IMO. The question is how IDLE should deal with it.

Regards, Martin