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;

  

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM