[Interest] Preventing QUrl from encoding query parameters

Lorne Sturtevant dragor at shaw.ca
Sat Aug 2 01:33:19 CEST 2014

I am to connect to a 3rd party API over http.  This API does not accept
requests that the URLs that are properly percent encoded for invalid
characters.  For example.  It requires urls to be of the form:

I create the QUrl like this:
QUrl url =

url.toString() shows that the string is percent encoded as
http://example.com?query=[%7B%22name%22:%22value%22%7D] as it should
be.  The problem is that the 3rd part API can't handle the percent
encoded form.

I've tested this with curl as well:
curl http://example.com?query=[{"name":"value"}] returns the correct result.
curl http://example.com?query=[%7B%22name%22:%22value%22%7D] returns an
error from the 3rd party API.

So my question is.  How can I force QUrl not to percent encode the URL? 
Even though it's an error, I want QUrl to ignore it and just use the raw
string I provide.

Lorne Sturtevant
Sum Ergo Cogito

More information about the Interest mailing list