I18n issue with optik
Thorsten Kampe
thorsten at thorstenkampe.de
Mon Apr 2 11:10:49 EDT 2007
* Jarek Zgoda (Mon, 02 Apr 2007 17:52:34 +0200)
> 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,
You are right. My problem is that all the terminals I use are set to
US-ASCII (rxvt under Cygwin, Console[1] running bash, Poderosa[2]
running bash). Even those who actually support non-ASCII characters.
I got the tip to set a different encoding by
sys.stdout = codecs.EncodedFile(sys.stdout, 'utf-8')
but unfortunately this does not change the encoding.
So my question is: how can I set a different encoding to sys.stdout
(or why can I set it without any error but nothing changes?)
Thorsten
[1] http://sourceforge.net/project/screenshots.php?group_id=43764
[2] http://en.poderosa.org/present/about_poderosa.html
More information about the Python-list
mailing list