McMillan / Tk / encoding problem

Martin v. Löwis loewis at informatik.hu-berlin.de
Fri Oct 4 13:37:23 CEST 2002


Thomas Korb <Doc at goodweb.de> writes:

> Hi! I have a strange problem with an application written in Python 
> using Tk as GUI. I do use the Tk text-widget (as a simple editor)
> and wrote some encoding functions for transforming iso-8859-1 to
> Unicode and the other way round (when loading text to the widget
> or when pasting from the clipboard etc. etc.).

I'm surprised you need to write encoding functions. If you have a
Unicode object u, u.encode("iso-8859-1") will transform it to
iso-8859-1.

> Does someone know this problem? Any help highly appreciated!

I would recommend to add a little debugging into your script; please
report what you find.

For Python, please evaluate codecs.lookup('iso-8859-1') in your
script, and print a message on whether this fails or gives an
error. For Tk, evaluate 'encoding system' and 'encoding names' in a
tkapp object (e.g. through w.tk.call(('encoding','system'))), and
report what the string result is of these calls.

Regards,
Martin




More information about the Python-list mailing list