[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] unicode two-way conversion
From: Sebastian =?iso-8859-2?q?K=FCgler?= <sebas () kde ! nl>
Date: 2005-10-25 10:48:08
Message-ID: 200510251248.12340.sebas () kde ! nl
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
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" (application/x-python)]
[Attachment #8 (application/pgp-signature)]
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic