[PyKDE] unicode two-way conversion

Giovanni Bajo rasky at develer.com
Tue Oct 25 13:43:23 BST 2005


Diez B. Roggisch <deets at web.de> wrote:

> Then you need to _decode_ it as utf-8 to yield a unicode object. So the
> whole line should read
>
> self.user.data["achternaam"] =
> self.GAchternaam.text().utf8().decode('utf-8')


You're working way too hard to get an unicode string out of a QString:

self.user.data["achternaam"] = unicode(self.GAchternaam.text())

But Sebastian wanted a UTF-8 string, so calling .utf8() on the QString
should be sufficient.
-- 
Giovanni Bajo




More information about the PyQt mailing list