TIdHTTP
handles the gzip decompression for you, if you have a TIdCompressorZLib
component assigned to the TIdHTTP.Compressor
property. Otherwise, you will have to decompress it manually (TIdHTTP
will not send an Accept-Encoding
header by default if the Compressor
property is not assigned).
As for the UTF-8 encoding, TIdHTTP
also handles that for you as well, if you are calling the overloaded version of the TIdHTTP.Get()
or TIdHTTP.Post()
method that returns a String
value instead of fill a TStream
object. It will decode the UTF-8 to UTF-16 for you. To convert that to CP936, you can let the RTL do the conversion for you:
type
Cp936String = type AnsiString(936);
var
S: Cp936String;
begin
S := Cp936String(IdHTTP1.Get(...));