使用 idHTTP 获取 UTF-8 编码的中文网页

uses IdHTTP;

const Url = 'http://del.cnblogs.com';

procedure TForm1.Button1Click(Sender: TObject);
var
  stream: TStringStream;
  idHttpObj: TIdHTTP;
begin
  stream := TStringStream.Create('', TEncoding.UTF8); //

  idHttpObj := TIdHTTP.Create(nil);
  idHttpObj.Get(Url, stream);
  idHttpObj.Free;

  Memo1.Text := stream.DataString;
  stream.Free;
end;

https://www.cnblogs.com/del/archive/2011/12/30/2307965.html

猜你喜欢

转载自www.cnblogs.com/railgunman/p/10290716.html