Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Encoding problems with gettext and wxPython: how to do things in "good style"

Reply
Thread Tools

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

 
 
=?iso-8859-1?B?QW5kcuk=?=
Guest
Posts: n/a
 
      03-02-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Re: Python 3.3, gettext and Unicode problems Terry Reedy Python 0 12-31-2012 01:48 AM
Python 3.3, gettext and Unicode problems Marcel Rodrigues Python 0 12-31-2012 12:39 AM
Problems with gettext and msgfmt JKPeck Python 1 12-16-2009 02:21 PM
vs2005 publish website doing bad things, bad things =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?= ASP .Net 1 10-25-2006 06:18 PM



Advertisments