[Solved] fpweb / HTTP Server Application lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- IPguy · 2012-06-16 20:48 I'm dabbling with fpweb and HTTP server app, trying to understand web applications. I've added a text entry field on my web form as shown below. Code: [Select]
When I enter text with a space (ex: "John Doe"), what comes back from the sFormData := Trim(ARequest.Content); call is "NameFld=John+Doe". Why is the space being replaced by the +? When I use an = in the test field, it is replaced by %3D. Code: [Select]procedure TMain.DefaultRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); var sFormData : string; iLoc : Integer; sName : String; sData : String; FormData : TStringList; begin AResponse.ContentType := 'text/html;charset=utf-8'; AResponse.Contents.LoadFromFile('Index.html'); // sFormData := AResponse.Contents.Names[0]; sFormData := Trim(ARequest.Content); if sFormData <> '' then begin iLoc := Pos('=',sFormData); if iLoc > 0 then begin sName := LeftStr(sFormData,iLoc-1); sData := Copy(sFormData,iLoc+1,Length(sFormData)); end; case sName of 'NameFld' : AResponse.Contents.Add('' + sName + ' = ' + sData +''); 'sub1' : AResponse.Contents.Add('' + sName + ' = ' + sData +''); 'sub2' : AResponse.Contents.Add('' + sName + ' = ' + sData +''); else end; end; Handled := True; end; Any hints? Laz 1.1-36568, 2.6.1, win32-Vista ---------------------------------------------------------------------- IPguy · 2012-06-17 02:51 Never mind - I found the answer. I was not decoding the string coming back from the web form. I found the answer elsewhere and found a solution in the following http://www.lazarus.freepascal.org/index.php/topic,9184.msg68930.html#m sg68930