View Full Version : Is this bug or wrong code for PyQt4?

23rd May 2014, 11:15
I use PyQt4-4.10.3 for a long time. Yesterday I've upgraded it to pyqt4-4.10.4. But I've found and interesting thing about unicode characters from that version. Here is my example code to explain the situation:

#bla bla...

self.testtext = QLineEdit()
self.testbutton = QPushButton("Press It")
def testit(self):
print (self.testtext.text())

#bla bla...
When I input "şşş" it prints the text "şşş" perfectly. But When I input "Müş", it prints "Mü_".
I input "kır", it prints it correct. But when I input "çakır", it prints "çak1r".

Müş ---> Mü_
kır ---> kır
çakır --> çak1r

It's so interesting and PyQt4-4.10.3 is NOT doing this.

To sum up; i didn't get this bug when i was on previous PyQT version. The new version gives me this error. I use Python 3.3.5 and it's work with all unicode characters you know. But latest version of PyQt4 doesn't, I think. So what's your suggestions?

Note: I removed 4.10.4 and installed 4.10.3 version. But I want to know what's wrong with 4.10.4?


23rd May 2014, 11:50
First make sure print() is not responsible to incorrectly displaying the text.

23rd May 2014, 12:51
Normally I don't use print(), I used it only for a good explanation. In fact; I insert the text into a mysql table. And the text is not saved correctly to mysql. Some characters change to 1 and _. Also; 4.10.3 is not doing this. I've experienced this only on 4.10.4.

By the way; I've looked at the changelog for 4.10.4. And found these:
changeset: 595c1453ae29
date: Sat Jan 04 17:12:32 2014 +0000
Fixed the PEP 393 conversion from QString to Python unicode objects so that it
properly handles surrogates. Also made the common case where the text is
Latin-1 faster and the final object smaller.

changeset: f24cac93a1b0
date: Thu Oct 03 18:38:09 2013 +0100
Fixed an incorrect (for Python2) format character.


Added after 36 minutes:

I've got an email from riverbankcomputing.com, they write: Try the current PyQt4 (and SIP) snapshots. There has been a fix for Unicode conversions. I have to look.