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