Tkinter / Unicode and UTF-8

Thomas pushcold at hotpop.foo
Sat Nov 22 09:56:25 EST 2003


On Sat, 22 Nov 2003 08:41:48 +0100, Martin v. Löwis wrote:

> 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.

I think that will not happen (at least not for the Fedora 1 Release). 
(My experience with RedHat is: security fixes: yes; bug fixes: no).
 

> 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).

Thanks for the explanation! Now I got it.


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

I just did that, following your advice. 

(Compiled Tcl/Tk 8.4 and Python 2.3 from the sources without
deleting the Fedora 1 installation of Python 2.2 and Tcl/Tk 8.3;
now - with my new Python/Tkinter 2.3, Tcl/Tk 8.4 - everything
works as usual. Both, Python and Tcl/Tk, use UCS-2 now.
I only had to rename the Python executable for Python 2.3 (so that
it does not get executed when the system actually wants to use its
own Python 2.2) and I have to use a startup script for Python 2.3 
setting LD_LIBRARY_PATH, because otherwise libtk8.4.so is not found 
by Python in /usr/local/lib. The 'LD_LIBRARY_PATH'-script could be
avoided with a permanent solution (symlink resp. ldconfig), but at 
the moment, this solution is OK for me.)


Thanks a lot for your help! This really drove me nuts :-)

Regards, Thomas.

-- 
mailto: pushcold at hotpop.foo (where: foo = com)





More information about the Python-list mailing list