percent encoding differs in QUrl in Qt4 vs Qt5



  • Anyone know why the percent encoding differs in QUrl in Qt4 vs Qt5. It appears to be wrong in Qt4....

    QUrl url(QString(John's iPho))

    actual bytes in QString
    4A 6F 68 6E E2 80 99 73 20 69 50 68 6F

    The ' is uft = E2 80 99

    QUrl in qt4 yields
    John%C3%A2%C2%80%C2%99s%20iPho

    QUrl in qt5.3.1 yields (correct)
    John%E2%80%99s%20iPho


  • Moderators

    @drwho said:

    Anyone know why the percent encoding differs in QUrl in Qt4 vs Qt5. It appears to be wrong in Qt4....

    That means there was a bug in Qt 4, and the bug was fixed in Qt 5.



  • The QString is being formed from a QByteArray. When I make the QString via

    QString::fromUtf8(QByteArray)

    QUrl in Qt4 correctly percent encodes the QString. I don't think there is a bug in QUrl in Qt4, I guess QUrl in Qt5 is more tolerant.


Log in to reply