[PyQt] Python3 Qt4 and string encoding issues

rohan at kde.org rohan at kde.org
Tue Apr 15 12:32:13 BST 2014


> Just a small follow up, the string is correctly encoded in the combobox , so
> it's only the conversion back from a QString to a python string that is
> troublesome.
> 
> Cheers
> Rohan Garg

Harald Sitter (CC'd) wrote a patch that potentially solves this issue :

Index: python-qt4-4.10.4+dfsg/qpy/QtCore/qpycore_qstring.cpp
===================================================================
--- python-qt4-4.10.4+dfsg.orig/qpy/QtCore/qpycore_qstring.cpp	2014-03-14 
15:19:06.000000000 +0100
+++ python-qt4-4.10.4+dfsg/qpy/QtCore/qpycore_qstring.cpp	2014-04-15 
13:28:50.022157511 +0200
@@ -82,6 +82,7 @@
 
             do
             {
+                uch = qch->unicode(); // Keep updating the uch, as the qch is 
also changing.
                 if (uch > 0x00ff)
                 {
                     if (maxchar == 0x00ff)
@@ -93,12 +94,12 @@
                     {
                         maxchar = 0x10ffff;
                         --py_len;
-                        ++i;
-                        ++qch;
+                        ++qch; // Upping twice here as it is a pair.
                     }
                 }
+                ++qch;
             }
-            while (++i < qstr.length());
+            while (!qch->isNull());
 
             // Create the correctly sized object.
             if ((obj = PyUnicode_New(py_len, maxchar)) == NULL)


Could someone review this?

Cheers
Rohan Garg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140415/3dab625f/attachment.pgp>


More information about the PyQt mailing list