[PyKDE] unicode two-way conversion
Giovanni Bajo
rasky at develer.com
Tue Oct 25 13:19:28 BST 2005
Sebastian Kügler <sebas at kde.nl> wrote:
> 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?
Quickly skimming through QString docs reveals a utf8() method. Otherwise,
you can call unicode() just as you would call str(), and then using
unicode.encode.
--
Giovanni Bajo
More information about the PyQt
mailing list