On Tuesday 25 October 2005 14:39, Diez B. Roggisch wrote: > > 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 > > text() returns a QString, which you should look up in the > qt-reference-manual. That reveals the method > > QString::utf8() > > which returns a QCString. And that should be converted to a python byte > string (by means of sip I think)
That doesn't seem to be the case, it's a QCString at that point. > 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') That throws me an AttributeError on encode(). However, if I use ascii(), it seems to work fine both ways: self.GAchternaam.text().ascii() Thanks for helping with that! -- sebas http://www.kde.nl | http://vizZzion.org | GPG Key ID: 9119 0EF9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Natural selection won't matter soon, not anywhere as much as concious selection. We will civilize and alter ourselves to suit our ideas of what we can be. Within one more human lifespan, we will have changed ourselves unrecognizably. - Greg Bear
pgpArEq2n2DT0.pgp
Description: PGP signature
_______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde