[Interest] Code using QNetworkAccessManager::post() working on Linux but not on Mac

René J. V. Bertin rjvbertin at gmail.com
Sun Aug 27 10:47:49 CEST 2017

Thiago Macieira wrote:

>> I have no idea. I just note that the data with the current call is different
>> from what QUrlQuery gives; I didn't try the QUrlQuery result because I have
>> no idea of the potential implications of those differences.
> Can you elaborate what comes out differently?

QUrl::toPercentEncoding() encodes anything that doesn't look like isalnum

unencoded data: "a=update&s=2.0&p=passphras/r=(Fake^Password)&v="
QUrl::toPercentEncoding(dataToEncode, "&=") : 
QUrlQuery::toString() : 
QUrlQuery::query() : 

But again, even if those are exchangeable, why is QUrlQuery better? As far as I 
can tell I'd be using that class or QUrl to construct something that's not an 
URL. Something that could be done directly by 
{QString,QByteArray}::toPercentEncoding() if such a method existed. And at best 
I'd be replacing 2 calls to construct that data buffer with 2 different calls. 
Or else 2 lines with 7.

Maintainability is maybe a bit better with the API where each key/value pair is 
added individually. But this is not a case where anything is likely to change 
(or be refactored) often except possibly for the things that are already defined 
in macros.


More information about the Interest mailing list