On Tuesday 25 October 2005 12:28, Mateusz Korniak wrote:
> > When I read the data from the widget, I'm not able to insert strings into
> > the database using unicode. I can replace the offending characters with
> > 'string'.encode('ascii', 'xmlcharrefreplace').
>
> Encode to (and back from) utf-8.
> Remember only that utf-8 representation is longer than number of chars in
> unicode string if any non 7bit ascii char is used.
> Also make sure that Yours DB iface allows to use 8bit encoding (like
> iso-8859-1/2).
Ah, that helps the problem in my test script. Now I'm encountering a problem
encoding the input of a QLineedit:
File "john.py", line 154, in dataFromGuiToUser
self.user.data["achternaam"] = self.GAchternaam.text().encode('utf-8',
'strict')
AttributeError: encode
So the problem is that I'm not able to convert the QString to utf-8 (without
making it a str first, which bails out on UnicodeDecodeError. See attached
snippet.
Any idea?
--
sebas
http://www.kde.nl | http://vizZzion.org | GPG Key ID: 9119 0EF9
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
A day without sunshine is like a day without orange juice.
unicode-test.py
Description: application/python
pgpdx9YJ23sYh.pgp
Description: PGP signature
_______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
