I18n issue with optik

Jarek Zgoda jzgoda at o2.usun.pl
Mon Apr 2 17:52:34 CEST 2007


Thorsten Kampe napisał(a):

> I can't see the "solution" here. Is the optparse "print_help" function 
> wrong? Why should there even be errors if I use "unicode = True" with 
> gettext.install?
> 
> I have ISO-8859-15 gettext translations and I want optparse to display 
> them correctly. What do I have to do?

Please, see gettext module documentation on this topic.

The solution is: always install your translation with unicode=True
setting. This assures usage of ugettext() instead of gettext() and works
properly with character sets other than ASCII. Your messages are
internally decoded to unicode objects and passed to output. Then the
displayed output will be limited only by the encoding of your terminal,
but it will not crash your program on any inconsistency, you would see
question marks.

-- 
Jarek Zgoda

"We read Knuth so you don't have to."



More information about the Python-list mailing list