Utf-8 code, test in IE, successfully submit data, but failed to submit data in Delphi, urgent for warrior grant instruction! The code is as follows:
Var
HttpClient: TIdHttp;
ParamList: TStringList;
SS: TStringStream;
S: a string;
The begin
SS:=TStringStream. Create;
S:=Edit13. Text + 'OrderNum' + '=' + Edit1. Text + '& amp; '
+ 'Datetime' + '=' + Edit2. Text + '& amp; '
+ 'Customer' + '=' + Edit3. Text + '& amp; '
+ 'Phone' + '=' + Edit4) Text + '& amp; '
+ 'Address' + '=' + Edit5. Text + '& amp; '
+ 'Appointment' + '=' + Edit6. Text + '& amp; '
+ 'Remark' + '=' + Edit7. Text + '& amp; '
[' + 'ItemList=' + '
{' + + '
CRH (34) + 'Item' + CRH (34) + ', '+ CRH (34) + Edit8. Text + CRH (34) +', '+
CRH (34) + 'Qty + CRH (34) +', '+ CRH (34) + Edit9. Text + CRH (34) +', '+
CRH (34) + 'ItemType + CRH (34) +', '+ CRH (34) + Edit10. Text + CRH (34) +', '+
CRH (34) + 'Distribution' + CRH (34) + ', '+ CRH (34) + Edit11. Text + CRH (34) +', '+
CRH (34) + 'Installation + CRH (34) +', '+ CRH (34) + Edit12. Text + CRH (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);
CodePudding user response:
Chinese garbled?If it is garbled, I'm change IDHTTP source code
IdCustomHTTPServer unit,
Procedure TIdHTTPRequestInfo. DecodeAndSetParams (const AValue: String).
.
//CharSet:=';
Utf-8 CharSet:=' ';//modify
Line 1788