Indy10下使用TIDHTTP出现乱码的原因是因为编码问题,可以使用如下方法来解决!
[Quote title=""]
procedure TWeatherThread.GetWeather;
var
AURL: string;
ANetData: TStringStream;
begin
try
AURL := 'http://www.4936.cn';
ANetData := TStringStream.Create('', TEncoding.GetEncoding(936));
try
ANetData := FIDHttp.Get(AURL);
// ANetData.DataString 就是获取到的源码
finally
ANetData.Free;
end;
except
on E: Exception do
begin
OutputDebugString(PChar('[TWeatherThread.GetWeather]:' + E.Message));
end;
end;
end;
[/Quote]
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.03252100944519 seconds