我怎么能强迫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;