[PyKDE] QObject.trUtf8 doesn't accept unicode strings.

Rick van Hattem Rick.van.Hattem at fawo.nl
Wed Jan 3 15:13:49 GMT 2007

Hello everyone,

I was just writing some code today and after a while I came across some code 
that used unicode strings, normally not a problem but I noticed that tr and 
trUtf8 both don't accept unicode strings. Would it be possible to add this 
since it would be logical to convert a python unicode string to a QT escaped 
unicode string.

Example code:
from PyQt4 import QtCore
object = QtCore.QObject()

normal_string = str('test')
unicode_string = unicode('test')

''' this works '''

''' this doesn't '''

Naturally, the bottom two give a TypeError but I would expect it to do a cast 
to str() for tr or just accept the string for trUtf8.

Rick van Hattem	Rick.van.Hattem(at)Fawo.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070103/bb17f709/attachment.bin

More information about the PyQt mailing list