本文整理自网络,侵删。
Indy10下使用TIDHTTP出现乱码的原因是因为编码问题,可以使用如下方法来解决!
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;
相关阅读 >>
Delphi xe android platform uses-permission[2] androidmanifest.xml 配置
Delphi 获取本机 hostname ip address
Delphi firedac sqlite不能插入"&"符号
更多相关阅读请进入《Delphi》频道 >>