如何强制 TIdHttp.post 方法返回以 utf-8 编码的网页?我试过http.Request.ContentEncoding := 'UTF-8'
了,但它不起作用。这是我的代码:
procedure TeUpdateNews.Check;
var url: string;
Http: TIdHttp;
SS: TStringStream;
param: TStringList;
SWIDESTRING: WideString;
begin
http := TIDHttp.Create(nil);
http.HandleRedirects := true;
http.ReadTimeout := 5000;
http.Request.ContentEncoding := 'UTF-8';
param := TStringList.create;
param.Clear;
url := CONST_SOME_WWW;
try
SS := TStringStream.Create;
try
SWIDESTRING := http.Post(url, param);
// it's not getting utf-8!
ShowMessage(SWIDESTRING);
finally
SS.Free;
param.free;
end;
finally
Http.Free;
end;
end;