delphi idhttp post 普通提交乱码处理


本文整理自网络,侵删。

 

var
  IdHTTP1:TIdHTTP;
  postStream : TStringStream;
  Wstr:WideString;

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;
  

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

来源:https://blog.csdn.net/weixin_30622181/article/details/95023193

相关阅读 >>

Delphi idhttp post中文的问题

Delphi 正则表达式在每行开头插入行号

Delphi 通过api 隐藏任务栏所有托盘图标

Delphi xe2 硬盘序列号

Delphi驱动开发研究第一篇--实现原理

Delphi dateof、timeof、yearof、monthof、weekof、dayof、hourof、minuteof、secondof、millisecondof �c 提取时间成分

Delphi Delphi中点击dbgrid某一行获得其详细数据方法

Delphi 的链式代码

Delphi 数字转换成中文

Delphi free和freeandnil之间的区别

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



打赏

取消

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

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

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

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

评论

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