--===============0550413890== Content-type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary=nextPart1304562.h6K9nXejW7 Content-transfer-encoding: 7bit --nextPart1304562.h6K9nXejW7 Content-Type: multipart/mixed; boundary="Boundary-01=_vUgXD3iCCKv87hJ" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_vUgXD3iCCKv87hJ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, (I'm posting to this list since I think it's likely that someone here ran=20 across the same problem.) I'm working on a database frontend for a postgresql database, and I'm havin= g=20 an issue with unicode characters that I've put into the Qt UI. When I read the data from the widget, I'm not able to insert strings into t= he=20 database using unicode. I can replace the offending characters with=20 'string'.encode('ascii', 'xmlcharrefreplace'). So what I basically need is a two-way conversion between unicode strings an= d=20 ascii (or at least something that is easily usable together with psycopg an= d=20 postgres' character fields. Attached scriptlet should show that problem. Thanks for enlightenment, =2D-=20 sebas http://www.kde.nl | http://vizZzion.org | GPG Key ID: 9119 0EF9=20 =2D - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -= - This joke was brought to you by the Department of Redundancy Department. --Boundary-01=_vUgXD3iCCKv87hJ Content-Type: application/x-python; name="unicode-test.py" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="unicode-test.py" # -*- coding: UTF-8 -*- naam =3D u"gr=C3=BCmblz" # This works fine "bla" + naam + "bla" ascii =3D naam.encode('ascii', 'xmlcharrefreplace') # gives "grümblz" print ascii # Here I'd like to have unicode back,=20 # so that it'd throw an exception while # printing print "unicode:", unicode(u"%s"%ascii) --Boundary-01=_vUgXD3iCCKv87hJ-- --nextPart1304562.h6K9nXejW7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iQEVAwUAQ14FL2dNh9WRGQ75AQJUQgf+NcAiuC2nvUBPKjUdGTfHhfo5vHGooDvS D2CjHqFmhnOWsUvdU0vXGayDSow8y/jpZtz6s8Fkexgn8Hfern2JuTcPwrfLLR9r qstKJiTFYiPR/Cjhx+vXd6L449RhVvLTHMJETXfCRXYINeOtQ1QA/Z062bm8Ra+a 0R5msHSaU3yglVIQ0YvMdOrQlNpToOk6iADMYcCtj1P6ojOwUiAVQxsNXND/DWb6 JDKG9Q10tIyVaSHnFoLj7OHN3Cv9GWPOTRwMw/b4jJ4ahRc9ZZOWcD8CIKVltF2l L3HlY6TT3bkTxLx06BveekkTBCjFzUz/RPo/2/SSErDigc/Ov+0o/A== =gKXs -----END PGP SIGNATURE----- --nextPart1304562.h6K9nXejW7-- --===============0550413890== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde --===============0550413890==--