How to save HTTP data in UTF-8 format

 This sample shows how to save data received by the TclHttp component in the UTF-8 format in Delphi 2009, 2010, XE and XE2.

var
  strURL: string;
  html: TStringStream;
begin
  strURL:='Something here';
  html :=   TStringStream.Create('', TEncoding.UTF8);
 
  try
 
    clHttp1.Get(strURL,html);
 
    Memo1.Text:=html.DataString;
  finally
    html.Free;
  end;
 
end;

 

Add Feedback