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 如何从html格式的字符串中提取纯文本?

Delphi 立即停止timer

Delphi 大小写字符串转换

Delphi 设置combobox组合框的高度方法总结

Delphi 让程序只运行1次

Delphi异常处理try except语句和try finally语句用法以及区别

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

Delphi 从摄像头获取照片并转换为特定的格式

Delphi xe 与plc通讯(intcpserver 二进制)

Delphi 判断一个颜色是否是亮色

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



打赏

取消

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

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

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

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

评论

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