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 treeview �c 自动给标题上加图片

Delphi 下找到目录中的所有文件夹

Delphi webbrowser载入自定义html内容并显示

Delphi firemonkey 保存图片到jpg的方法 bmp转jpg

Delphi cpu窗口的扩展学习

winapi 字符及字符串函数(5): ischaralpha - 是否是个字母

Delphi zlib 流压缩解压

Delphi 字符串插入与删除

Delphi tedit 编辑框 中文使用说明

Delphi删除整个目录及目录下的文件

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



打赏

取消

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

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

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

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

评论

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