Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Reserved characters URL encoding



  • Good day, collagues!

    I want to encode part of my HTTP POST request, which contains XML. I try this:

    @post_data.append(QUrl(xml_array).toEncoded());@

    But ampersands hadn't been encoded. How can I automatically encode ampersands and other URL reserved characters?



  • Hmm, it seems that I should read documentation more carefully:

    @QByteArray toPercentEncoding ( const QByteArray & exclude = QByteArray(), const QByteArray & include = QByteArray(), char percent = '%' ) const@


Log in to reply