Tkinter disregards font encoding

Hans-Joachim Widmaier hjwidmaier at web.de
Tue Nov 5 00:49:22 EST 2002


loewis at informatik.hu-berlin.de (Martin v. Löwis wrote in message news:<j4n0op68yi.fsf at informatik.hu-berlin.de>...

> What is the value of self.priceVar?

It's a (normal) string.
 
> Here is my theory: you are using a Latin-1 locale, and use a byte
> string for the priceVar, where you use '\xe4' to denote the EURO SIGN.
> However, in Latin-1, '\xe4' denotes the CURRENCY SIGN. Tk tries to
> convert the local encoding (latin-1) into the font encoding (latin-9);
> since latin-9 does not support the CURRENCY SIGN, this conversion
> fails.

My locale is set to 'de_DE at euro', which ought to result in using
Latin-9. (At least that's what I thought.) I just tried my program on
my box at work, and, without any changes,  I got a euro sign. Sigh.

> Instead, you should use a Unicode string to denote the EURO SIGN,
> which would be u'\u20ac'.

I'll try that. Thanks.

Hans-Joachim



More information about the Python-list mailing list