[Tutor] Handling international characters
Jorge Godoy
godoy@ieee.org
Wed May 21 13:39:59 2003
Hi!
I'm having problems with some characters in two distinct places:
* wxPython
* pgdb (PostgreSQL access module)
For wxPython it seems to me that all my characters are converted to
Unicode, even if the XRC file states that they are encoded in
iso-8859-1. The result is that some wxStaticText show up with messed
text on chars like '=E7', '=B0', etc. Is there something I can do to use
iso-8859-1 with it (it would cause me some problems to have to switch
to UTF-8 due to some collaborators and multiplatform stuff on a
project)?=20
(Please, note that I'm using the XRC and not coding it directly in
Python, where strings are printed correctly... I suspect that there's
something related to the minidom/XML stuff...)
With regards to pgdb, the result is a little better: I see the Unicode
code, but I don't see the correct char (I see them correctly with
psql, so this is not a database problem).
One sample output is:
----------------------------------------------------------------------
[['Jorge', 'Godoy'], ['Juliano', 'Godoy'], ['\xc9rica', 'Balaniuc']]
----------------------------------------------------------------------
The '\xc9' should be an '=C9'.=20
I've already added the following statement (from
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/datasources/=
drivers/postgresql/pygresql/Driver.py?rev=3D1.41&content-type=3Dtext/vnd.=
viewcvs-markup
) to my code:
----------------------------------------------------------------------
cursor.execute("SET CLIENT_ENCODING TO 'iso-8859-1'")
----------------------------------------------------------------------
(and case variations such as 'ISO-...', 'Iso-...' and even
'ISO8859-1', but I had no success with that)
I'm also following --- in both cases --- the PEP-263 recommendation of
specifying the encoding used in my source code as 'iso-8859-1'.=20
Any hints would be greatly appreciated. If you'd like a sample of
source code and/or database entries, I can provide you with that.
TIA,
--=20
Godoy. <godoy@ieee.org>