【发布时间】:2018-07-24 03:51:46
【问题描述】:
我正在使用TIdHTTPServer 和TIdHTTP 测试本地主机服务器。我在编码 UTF8 数据时遇到问题。
客户端:
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
res: string;
begin
res:=IdHTTP1.Get('http://localhost/?msg=đi chơi thôi');
Memo1.Lines.Add(res);
end;
服务器端:
procedure TForm1.OnCommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
Memo1.Lines.Add(ARequestInfo.Params.Values['msg']); // ?i ch?i th?i
AResponseInfo.CharSet := 'utf-8';
AResponseInfo.ContentText := 'chào các bạn'; // chào các b?n
end;
我想发送đi chơi thôi 并接收chào các bạn。但是服务器接收?i ch?i th?i,客户端接收chào các b?n。
谁能帮帮我?
【问题讨论】:
标签: delphi utf-8 indy delphi-xe7 indy10