I18n issue with optik

Thorsten Kampe thorsten at thorstenkampe.de
Sun Apr 1 15:22:51 EDT 2007


* Thorsten Kampe (Sun, 1 Apr 2007 20:08:39 +0100)
> * Thorsten Kampe (Sun, 1 Apr 2007 19:45:59 +0100)
> > Yes, I could do that but I'd rather know first if my code is wrong or 
> > the optparse code.
> 
> It might be the bug mentioned in 
> http://mail.python.org/pipermail/python-dev/2006-May/065458.html
> 
> The patch although doesn't work. From my unicode-charset-codepage-
> codeset-challenged point of view the encoding of sys.stdout doesn't 
> matter. The charset is defined in the .po/.mo file (but of course 
> optparse can't know if the message has been translated by gettext 
> ("_").

If I "patch" line 1648 (the one mentioned in the traceback) of 
optparse.py from

file.write(self.format_help().encode(encoding, "replace"))
    to
file.write(self.format_help())

...then everything works and is displayed fine (even without the 
"unicode = True" parameter to gettext.install).

But the "patch" might make other things fail, of course...

Thorsten



More information about the Python-list mailing list