I have a string that becomes the query string part of a url and has to be url encoded.
QString queryStringParam = "J1mOEfg/TC";
So, I tried to use QUrl::toPercentEncoding() like this
QString encodedQueryString = QUrl::toPercentEncoding(queryStringParam);
which results in "J1mOEfg%2FT" but the webservice that I’m calling is expecting "J1mOEfg%2fT" [note the lowercase ‘f’ in the encoding of ‘/’ to ‘%20f’] and hence rejects the parameter. It’s probably bad on the service’s side but I can’t do anything about it. How can I get lowercase encoding hex chars while maintaining the case in the rest of the parameter?
I don’t think you can do it with standard functions, but you can easily write your own. In percent-encoded strings special characters are encoded with a
%symbol that is followed by a pair of hex digits. Knowing that, you can write a function like this: