delphi 网上获取北京时间IdHTTPServer and IdHTTP 使用 Encoding UTF8


本文整理自网络,侵删。

 

IdHTTP1.Get('http://localhost/?msg=' + TIdURI.ParamsEncode('中国人'));

 

AResponseInfo.ContentType := 'text/plain';

AResponseInfo.CharSet := 'utf-8';

AResponseInfo.ContentText := '中国人';

Or:

 

AResponseInfo.ContentType := 'text/plain; charset=utf-8';

AResponseInfo.ContentText := '中国人';

 

procedure TForm1.OnCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);

var

  msg: string;

begin

  msg := ARequestInfo.Params.Values['msg'];

  TThread.Synchronize(nil,

    procedure

    begin

      Memo1.Lines.Add(msg);

    end

  );

  ...

end;

相关阅读 >>

Delphi 解决webbrowser不能复制的问题

Delphi 数组类型与数组指针的巧妙利用

Delphi下pos机控制钱箱,客显,打印机

Delphi真正实现延时暂停功能

Delphi 使用google translate实现tts

Delphi 如何识别应用程序没有响应

如何在Delphi xe中通过ftp下载文件

Delphi多线程学习:多线程数据库查询(ado)

Delphi xe6调用android标准功能

Delphi cxgrid使用小结

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



打赏

取消

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

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

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

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

评论

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