3 Jan 2007 16:13
QObject.trUtf8 doesn't accept unicode strings.
Rick van Hattem <Rick.van.Hattem <at> fawo.nl>
2007-01-03 15:13:49 GMT
2007-01-03 15:13:49 GMT
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 '''
object.tr(normal_string)
object.trUtf8(normal_string)
''' this doesn't '''
object.tr(unicode_string)
object.trUtf8(unicode_string)
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
(Continue reading)
RSS Feed