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

Discussion in 'Python' started by =?iso-8859-1?B?QW5kcuk=?=, Mar 2, 2006.

  1. 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
     
    =?iso-8859-1?B?QW5kcuk=?=, Mar 2, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?B?aWFuYXLp?=

    gettext errors with wxPython in linux

    =?iso-8859-1?B?aWFuYXLp?=, May 17, 2006, in forum: Python
    Replies:
    0
    Views:
    290
    =?iso-8859-1?B?aWFuYXLp?=
    May 17, 2006
  2. =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=

    vs2005 publish website doing bad things, bad things

    =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?=, Oct 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    621
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Oct 25, 2006
  3. JKPeck
    Replies:
    1
    Views:
    1,207
    JKPeck
    Dec 16, 2009
  4. Marcel Rodrigues

    Python 3.3, gettext and Unicode problems

    Marcel Rodrigues, Dec 31, 2012, in forum: Python
    Replies:
    0
    Views:
    146
    Marcel Rodrigues
    Dec 31, 2012
  5. Terry Reedy
    Replies:
    0
    Views:
    161
    Terry Reedy
    Dec 31, 2012
Loading...

Share This Page