idhttp采集时遇到乱码问题解决

关键部分代码:

FIdhttp.Request.Referer := SQL;
stream := TStringStream.Create('');
stream.Position := 0;

FIdhttp.Get(SQL, stream);

if Pos('utf-8',FIdhttp.Request.ContentType)>0 then  //根据返回类型获取编码
  s := Utf8ToAnsi(stream.DataString)
else
if UTF8Decode(stream.DataString)<>'' then
  s := UTF8Decode(stream.DataString)
else
s := stream.DataString;
bl_result := Analystr(s);

stream.Free;

上一篇:【转】PyQt5系列教程(七)控件


下一篇:The Doors