Tkinter / Unicode and UTF-8

"Martin v. Löwis" martin at v.loewis.de
Sat Nov 22 02:41:48 EST 2003


Thomas wrote:

> I just used the 'Python' and 'tkinter' RPMs from www.python.org to
> update ('rpm -U ...') the RPMs provided with the Fedora Core 1 Linux
> distribution. 

Which RPM did you use specifically? If it is

http://www.python.org/ftp/python/2.3.2/rpms/redhat-9/python2.3-tkinter-2.3.2-1pydotorg.i386.rpm

then you can't use it on Fedora 1: The RPM is for Redhat 9, after all,
not for Fedora 1.

> But (my main problem!): I still do not understand why the first
> example does not work, while the second does!?

Because you are using incorrect binaries. You will have to build Python
from source on Fedora 1, or wait for Redhat to fix the package.

The pydotorg RPM assumes that Tk uses UCS-4 internally, as it does on
Redhat 9. On Fedora 1, Tk uses UCS-2, so copying a Python Unicode string
into a Tcl Unicode string copies twice as many character as you have
(and overwrites some unrelated memory in the process).

There is, unfortunately, no way to detect the problem at run-time. So
I repeat: You *have* to compile from source.

Regards,
Martin





More information about the Python-list mailing list