[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] unicode two-way conversion
From:       "Giovanni Bajo" <rasky () develer ! com>
Date:       2005-10-25 12:19:28
Message-ID: 014801c5d95e$5843aab0$bf03030a () trilan
[Download RAW message or body]

Sebastian Kügler <sebas@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

_______________________________________________
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