[PyKDE] QObject.trUtf8 doesn't accept unicode strings.
Rick van Hattem
Rick.van.Hattem at fawo.nl
Wed Jan 3 17:44:29 GMT 2007
On Wednesday 03 January 2007 17:30, Giovanni Bajo wrote:
> Your source code should look like this:
> self.trUtf8("foo bar translate this")
> Notice that the return value of tr()/trUtf8() is obviously a QString
> (duck-typable and convertible to Python's unicode), so your application
> will still be fully unicode. It's only the literal in the source code
> (*immediatly* surrounded by the tr() call) which is a 8-byte str.
> BTW: since all my sources are UTF-8, I prefer to specify it as default
> encoding for tr (QTextCodec.setCodecForTr) so that I can later use the
> shorter tr() everywhere in the code.
In my case the code looks like this: self.trUtf8
These are all predefined messages so it's not a problem to translate them, why
it's a unicode string? Well, getting something from the database always
returns a unicode string with my current settings (and with good reason, some
data requires it).
Perhaps I'm doing something wrong or addressing it the wrong way but I fail to
comprehend why trUtf8 (which is supposed to be unicode) doesn't accept
Rick van Hattem Rick.van.Hattem(at)Fawo.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070103/e21c17a6/attachment.bin
More information about the PyQt