[PyQt] Bug in QString comparison
Giovanni Bajo
rasky at develer.com
Wed Sep 10 00:51:54 BST 2008
Hello Phil,
this looks weird to me (using sip 4.7.6, PyQt 4.4.2, Qt 4.4.0):
=======================================
$ python
Python 2.5.2 (r252:60911, May 7 2008, 15:21:12)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.Qt import *
>>> "a" == QString("a")
True
>>> u"a" == QString(u"a")
True
>>> a = u"\u30b5"
>>> b = QString(a)
>>> a
u'\u30b5'
>>> b
PyQt4.QtCore.QString(u'\u30b5')
>>> a == b
False
========================================
Why does the equality operator returns False?
Moreover: I can't appear to be able to print the QString:
========================================
>>> print a
サ
>>> print b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u30b5' in
position 0: ordinal not in range(128)
========================================
Thanks!
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
More information about the PyQt
mailing list