Using Delphi 10 Seattle FMX (tested with Win32 compiler)
I watched the nice skill sprint on "Practical Data Compression" by Jim McKeeth.
Unfortunately the video does not cover the new THttpNetClient/THttpNetRequest components.
As far as I understand, THttpNetRequest will automatically handle SSL and GZIP decompression.
In the code below I'm trying to download a gzip compressed text file encoded with UTF-8. I tested the file on http://www.gidnetwork.com/tools/gzip-test.php and it proofed to be compressed as gzip.
But on request completed, I get an EEncodingError "No mapping for the Unicode character exists in the target multi-byte code page".
What am I doing wrong?
procedure TForm1.Button1Click(Sender: TObject); begin NetHttpRequest1.AcceptCharSet := 'utf-8'; NetHttpRequest1.AcceptEncoding := 'gzip'; NetHttpRequest1.Get('http://www.mywebsite.nl/TestCompression.txt') end; procedure TForm1.NetHTTPRequest1RequestCompleted(const Sender: TObject; const AResponse: IHTTPResponse); begin Memo1.Lines.Text := AResponse.ContentAsString; end;