XE7下,IdHTTPServer的CommandGet取POST中文亂碼問題,但是同樣D7不會,怎么解決?
代碼完全一樣,XE7就亂碼了
procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
Request: string;
begin
ARequestInfo.ContentType :='text/html;Charset=UTF-8';
Request :=UTF8Decode(ARequestInfo.Params.text);
Memo1.Lines.Add(FormatDateTime('YYYY-MM-DD HH:NN:SS',NOW) +'rev:'+Request);
AResponseInfo.ContentType :='text/html;Charset=UTF-8';
AResponseInfo.ContentText:=UTF8Encode(Request);
end;
uj5u.com熱心網友回復:
uses HttpAPPRequest := ARequestInfo.UnparsedParams;
Request := HttpApp.HTTPDecode(Request);
這樣就可以了
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/93157.html
標籤:網絡通信/分布式開發
上一篇:Delphi資訊串列設計
