zoukankan      html  css  js  c++  java
  • delphi xe10 indy 表单post 方法, utf8编码


    // 亲测 不会乱码
    var CuId,ModelId,sid : Integer; lmsg : string; Idc: TIdHTTP; Ptxt : string; postJson,jo :ISuperObject; rst : Boolean; lmfd: TIdMultiPartFormDataStream; responseStream: TStringStream; begin Result := False; try lmfd := TIdMultiPartFormDataStream.Create; responseStream := TStringStream.Create(); lmfd.AddFormField('cuid',vcuid,'UTF-8').ContentTransfer := '8bit' ; lmfd.AddFormField('type',vtype,'UTF-8').ContentTransfer := '8bit'; Idc := TIdHTTP.Create(nil); Idc.ReadTimeout := 60000; Idc.ConnectTimeout := 60000; // Idc.Request.ContentType := 'application/json'; Idc.Request.ContentType := 'application/x-www-form-urlencoded'; Ptxt := ''; try try idc.Post(gqrurl,lmfd,responseStream); ptxt := responseStream.DataString; if ptxt <> '' then begin jo := so(ptxt); rst := jo.B['status']; if rst then begin Result := True; vmsg := jo.S['data']; end; end; except on e: exception do begin vmsg := e.Message; end; end; finally Idc.Free; end; FreeAndNil(responseStream); FreeAndNil(lmfd); except on e: exception do begin if responseStream <> nil then FreeAndNil(responseStream); if lmfd <> nil then FreeAndNil(lmfd); end; end;

      

  • 相关阅读:
    CSS3 字体
    capitalized-comments (Rules) – Eslint 中文开发手册
    heapq (Data Types) – Python 中文开发手册
    Java中的Java.lang.Math类| 1
    shell脚本的条件测试与比较
    centos7关闭防火墙
    vmwaretool安装
    mongodb
    php中0与空 Null false的区别
    git使用总结
  • 原文地址:https://www.cnblogs.com/iwana/p/13091211.html
Copyright © 2011-2022 走看看