Indy10下的TIdhttp控件获取源码乱码的解决方法


本文整理自网络,侵删。

 

 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 回车 选择下一个控件

Delphi 自动把combobox控件的内容里没有的内容加入列表中

Delphi图像hash算法,关于图像相似度问题

Delphi 自带rest调试工具 restdebugger 用法

Delphi xe5 android平台 调用 webservice

Delphi使用zlib压缩和解压文件

Delphi image1 图像旋转90

Delphi读写utf-8、unicode格式文本文件

Delphi中一段可以判断网络连接的代码

Delphi shellexecute 发送邮件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...