You have to set yourself the header for your QNetworkRequest
:
networkRequest.setRawHeader("Accept-Encoding", "gzip");
Then Qt doesn't decode for you in the reply.
We can see in the source of qhttpnetworkconnection.cpp for QHttpNetworkConnectionPrivate::prepareRequest
:
// If the request had a accept-encoding set, we better not mess
// with it. If it was not set, we announce that we understand gzip
// and remember this fact in request.d->autoDecompress so that
// we can later decompress the HTTP reply if it has such an
// encoding.
value = request.headerField("accept-encoding");
if (value.isEmpty()) {
#ifndef QT_NO_COMPRESS
request.setHeaderField("Accept-Encoding", "gzip");
request.d->autoDecompress = true;
#else
// if zlib is not available set this to false always
request.d->autoDecompress = false;
#endif
}