delphi idhttp post 普通提交乱码处理


本文整理自网络,侵删。

 

var
  IdHTTP1:TIdHTTP;
  postStream : TStringStream;
  Wstr:WideString;<br><br>res:WideString;
begin
 
 IdHTTP1 := TidHTTp.create(nil);
     try
        Wstr:= 'aaccount=' + aaccount;
        Wstr:=Wstr+'&'+'passwd=' +passwd;
  postStream:=TStringStream.Create(ansitoUTF8(Wstr));
        IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
 
      try
         res:=Utf8ToAnsi(IdHTTP1.Post(infoURl,postStream));
      except
       on E:Exception do
       begin
          MsgBox('错误信息:' +e.message);
       end;
      end;
        vJson := SO(res);
 
end;
  

用stringlistPOST提交时会乱码,改用该方法后解决。

相关阅读 >>

Delphi ado 连接mssql数据库

Delphi向imagelist中加入png类型的资源图片

Delphi 一个call应该如何写?

Delphi 获得控件所在的窗体

Delphi什么是thttpclient?

Delphi中判断webbrowser的页面是否加载完成

Delphi中判断操作系统是否是windows7

Delphi 反外挂,反破解思想代码

Delphi中treeview的一些应用

Delphi xe android将域名转化为ip

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



打赏

取消

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

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

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

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

评论

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