Encoding problems with gettext and wxPython: how to do things in "good style"

  • Thread starter =?iso-8859-1?B?QW5kcuk=?=
  • Start date
?

=?iso-8859-1?B?QW5kcuk=?=

I'm trying to change an app so that it uses gettext for translations
rather than the idiosyncratic way I am using. I've tried the example
on the wxPython wiki
http://wiki.wxpython.org/index.cgi/RecipesI18n
but found that the accented letters would not display properly. I have
found a workaround that works from Python in a Nutshell; however it is
said in that book that
"...this is not good style".

I would like to do things "in good style" :)

Here are some further details:
1. all the .po files are encoded in utf-8
2. my local sitecustomization uses iso-8859-1 (yes, I could easily
change it on *my* computer, but I want the solution to work for anyone
else, without asking them to change their local default encoding).
3. I am programming under Windows XP.

The workaround I use is to write the following at the beginning of the
script:
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
del sys.setdefaultencoding
====
I tried various other ways to change the encoding in the example given,
but nothing else worked.

I can live with the "bad style" workaround if nothing else...

André


I have tried
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top