Delphi indy10 http server and ExtJS submit form

I have a problem, I donโ€™t know how to solve it.

I have an Indy10 HTTP server. I have used Indy9 and Indy10 HTTP servers in many applications and have never experienced any problems. But now I am using Indy10 HTTP server with RAI ExtJS javascript infrastructure.

The problem is when I send data containing characters other than ansi. For example, when I send the letter "ฤ", which is a letter encoded in 1250 (Slovenian, Croatian ...), I get the following in Indy in the section "unparsed params" โ†’ "% C4% 8D". This is the correct hexadecimal representation of the letter "ฤ" encoded in utf-8. All of my pages are utf-8, and I never had a problem sending form data to Indy. I debugged the code and saw that I actually get a sequence of bytes: [37, 67, 52, 37, 56, 68]. This is the byte representation of the string "% C4% 8D". But, of course, Indy cannot correctly encode UTF-16. So an example. Actual form field:

FirstName=ฤrt

appears as follows:

FirstName=%C4%8Drt

I do not know how to solve this. I looked at ExtJS forums, but there is nothing in this thread. Does anyone know anything about this issue?

EDIT

If I encode ad JSON parameters, they do the right thing. I also tried the url to decrypt the parameters, but the result is incorrect. Maybe I missed something. I will look at it again. And yes, it seems that ExtJS URL encodes parameters

EDIT2

Ok, I discovered more. I compared the actual content of the message data. This is something like this:

Delphi 2006 (Indy10): FirstName=%C4%8D
Delphi 2010 (Indy10): FirstName=%C4%8D

In both cases, the non-parameterized parameters are identical. I turned on ParseParams and they are correctly disassembled on BDS2006, but in 2010 there are none. This is Indy10 filled with delphi. Is there a bug in this version or am I doing something wrong?

EDIT3

I downloaded the latest Indy10 nightly build. One more problem.

EDIT4

I have to accept my own answer.

+5
3

.

, . Indy unicode . , TStringList. :

Params.Add(TIdURI.URLDecode(s));

"TIdHTTPRequestInfo.DecodeAndSetParams". , , , unicode.

, , - "HTTPDecode" "HTTPApp.pas".

Params := TStringList.Create;
try
  Params.StrictDelimiter := True;
  Params.Delimiter := '&';

  // parse the parameters and store them into temporary string list
  Params.DelimitedText := UTF8ToString(HTTPDecode(UTF8String(Request.UnparsedParams)));
  // do something with params... 
finally
  Params.Free;
end;

, . - , , - ?

+4

, URL, :

uses
  idURI;

value := TIdURI.URLDecode( value );

, , . , , , % UC48D, . , TidURI.ParamsEncode , , Indy 10.

+1

I am using Delphi 7 and moving on to Indy 10. I found a probable problem with Portuguese characters and decided to change the source code below:

procedure TIdHTTPRequestInfo.DecodeAndSetParams(const AValue: String);
  ...
  //Params.Add(TIdURI.URLDecode(s)); //-- UTF8 supose
  Params.Add(TIdURI.URLDecode(s,TIdTextEncoding.Default)); //-- ASCII worked
  ...

end;

+1
source

All Articles