Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31660

Percent Encoding doesn't seem to be working for '+' in QUrl

    XMLWordPrintable

Details

    • 993bbb4d4be524321575668740ea46c6665d6064 2ff719de8fe7a6ec40d1e085ad3211a4fd09fe69

    Description

      We are porting our project from qt 4.8 to 5.0.2 and have run in to a problem with how the '+' character is encoded and decoded in the QUrl. An example URL is like this:

      QString url = https://testurl.net/gf%2Fe51f1774%2FTKIsnXER5yHjPSj9h9N5W9qexRRaZ1NEOkdOdqF%2FYNht6fwqs%2Fnq0edOKoMJ26UKwu44ww3n7Y6d%0ACewL43WiP1LrJUYYTEv3YusoRZfv4BY3L%2FdF2gKQpJh4AkF%2B8P1FD2Ftl7DztJT7v

      I pass this URL in to a QUrl constructor via:

      const QUrl qurl (QUrl::fromEncoded ( url.toUtf8 () ));

      The issue is that when I look at the request go out on the wire I see this:

      https://testurl.net/gf%2Fe51f1774%2FTKIsnXER5yHjPSj9h9N5W9qexRRaZ1NEOkdOdqF%2FYNht6fwqs%2Fnq0edOKoMJ26UKwu44ww3n7Y6d%0ACewL43WiP1LrJUYYTEv3YusoRZfv4BY3L%2FdF2gKQpJh4AkF+B8P1FD2Ftl7DztJT7v

      You can see at the end of the URL %2B has been replaced with + which is no longer a valid URL for us. I see the + when I call QUrl.toString(QUrl::None) as well.

      In QT 4.8.4 the above works correctly, meaning that the QUrl encodes the + sign back to %2B when making the actual network request.

      I noticed in the QT 5.0 documentation that the QUrlQuery class talks about how a + is not encoded or decoded so I'm wondering if this affecting a + found in the non-query portion of the url.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              thiago Thiago Macieira
              meflynn Mike Flynn
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes