Solved QNetworkReply->request().url().toString() does not encode space in url
-
GET url (1st) is like :
https://requesturl¶m=--directory%20..%2Fwork%2Fnew_rand_tables%20condition
2nd: QNetworkReply->request().url().toString(): encode "=" or "/", but not space
https://requesturl¶m=--directory ..%2Fwork%2Fnew_rand_tables condition
3rd: If use QUrl::toPercentEncoding(reply->url()->toString()), this will encode space , but also encode %2, so it will be
https://requesturl¶m=--directory%20..%252Fwork%252Fnew_rand_tables%20condition
But this 3rd url is different from the original url (1st), i would not use 3rdUrl.replace("%25", "%").
How to make 3rd url is the same as 1st url. (By the way, url is the key to retrieve handler).
Thanks for comments.
-
request().url().toString(QUrl::FullyEncoded)
-
Updated, Solved by using
reply->request().url().toString(QUrl::FullyEncoded);
-
@Bonnie wow, thanks a lot. Also just find this function and prove your suggestion, thanks a lot.