Results 1 to 3 of 3

Thread: Is this bug or wrong code for PyQt4?

  1. #1
    Join Date
    May 2014
    Posts
    2
    Qt products
    Platforms
    Windows

    Default Is this bug or wrong code for PyQt4?

    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:

    Qt Code:
    1. #bla bla...
    2.  
    3. self.testtext = QLineEdit()
    4. self.testbutton = QPushButton("Press It")
    5. self.testbutton.pressed.connect(self.testit)
    6. self.grid.addWidget(self.testtext,0,0)
    7. self.grid.addWidget(self.testbutton,1,0)
    8. #...
    9. def testit(self):
    10. print (self.testtext.text())
    11.  
    12. #bla bla...
    To copy to clipboard, switch view to plain text mode 
    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".

    So;
    ÅŸÅŸÅŸ ---> ÅŸÅŸÅŸ
    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?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Is this bug or wrong code for PyQt4?

    First make sure print() is not responsible to incorrectly displaying the text.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2014
    Posts
    2
    Qt products
    Platforms
    Windows

    Default Re: Is this bug or wrong code for PyQt4?

    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.


    Hmm?


    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.
    Last edited by Rictrunks; 23rd May 2014 at 11:51.

Similar Threads

  1. What's wrong with my code?
    By Dave2011 in forum Newbie
    Replies: 4
    Last Post: 12th August 2011, 22:35
  2. What is wrong with this code?
    By Jeffb in forum Newbie
    Replies: 6
    Last Post: 18th February 2011, 07:35
  3. Replies: 6
    Last Post: 26th April 2010, 16:47
  4. What is wrong with my code?
    By Dante in forum Qt Programming
    Replies: 27
    Last Post: 6th April 2009, 07:56

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.