http://lxdq.cai-yun.net/service.php/API/Order/generate_order?OrderNum=124834931&Datetime=1224834931&Customer=張三&Phone=18871216316&Address=張三豐路&Appointment=1224834931&Remark%20=送支架&ItemList=[{"Item":"海信電視","Qty":"2","ItemType":"2","Distribution":"1","Installation":"30"}]
utf-8碼,在IE中測驗,提交資料成功,但是在delphi中提交資料失敗,急求大俠賜教!代碼如下:
var
HttpClient: TIdHttp;
ParamList: TStringList;
SS: TStringStream;
s: string;
begin
SS := TStringStream.Create;
s:= Edit13.text + 'OrderNum' + '=' + Edit1.Text + '&'
+ 'Datetime' + '=' + Edit2.Text + '&'
+ 'Customer' + '=' + Edit3.Text + '&'
+ 'Phone' + '=' + Edit4.Text + '&'
+ 'Address' + '=' + Edit5.Text + '&'
+ 'Appointment' + '=' + Edit6.Text + '&'
+ 'Remark ' + '=' + Edit7.Text + '&'
+ 'ItemList=' + '['
+'{'+
Chr(34) + 'Item' + Chr(34) + ':' + Chr(34) + Edit8.Text + Chr(34) + ','+
Chr(34) + 'Qty' + Chr(34) + ':' + Chr(34) + Edit9.Text + Chr(34) + ','+
Chr(34) + 'ItemType' + Chr(34) + ':' + Chr(34) + Edit10.Text + Chr(34) + ','+
Chr(34) + 'Distribution' + Chr(34) + ':' + Chr(34) + Edit11.Text + Chr(34) + ','+
Chr(34) + 'Installation' + Chr(34) + ':' + Chr(34) + Edit12.Text + Chr(34) +
'}'+
']';
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Request.CharSet := 'utf-8';
IdHTTP1.Request.ContentEncoding := 'utf-8';
IdHTTP1.GET(s, SS);
ShowMessage(SS.DataString);
uj5u.com熱心網友回復:
是不是中文亂碼?如果是亂碼,我是改IDHTTP的源代碼
IdCustomHTTPServer單元,
procedure TIdHTTPRequestInfo.DecodeAndSetParams(const AValue: String);
......
//CharSet := '';
CharSet := 'utf-8'; //修改
1788行
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/66200.html
標籤:網絡通信/分布式開發
