Hi Tom,
first of all, I'm not a expert for client/server communication, but I
will try my best. :-)
I looked also into the implementation on qx.io2.HttpRequest. I saw that
the method send() set the content-type to
"application/x-www-form-urlencoded" if the "POST" method is used. This
assume, that the ampersand must be encoded if the ampersand is part of
your value. [1]
Please try this:
req.setData("data=" + encodeURIComponent(data));
I hope that this solve your problem.
Cheers,
Chris
[1] http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
tsmiller schrieb:
> Hello Qooxdoo Guys,
>
> I still have the same problem. I am sending a POST request to my cherrypy
> server via the qx.io2.HttpRequest object. The data being sent is the string
> representation of a dictionary. For example, using
>
> data = {"people" : "Tom & Jerry"};
> data = qx.util.Json.stringify( data );
>
> req = new qx.io2.HttpRequest();
> req.setUrl("myServerUrl");
> req.setMethod("POST");
> req.setMime("application/json");
>
> req.setData( "data=" + data );
>
> req.send();
>
> I traced this call to qx.bom.Request.js at line 300 or so, to the code
> this.__xmlhttp.send(data) The data is valid at this point.
>
> My cherryPy server gets the request in two variables args and kwargs
> (hopefully you are familiar with cherrypy)
>
> if the data being sent from qx.bom.Request.js = {"people" : "Tom and
> Jerry"}, then kwargs on my server is equal to {'data': '{"people":"Tom and
> Jerry"}'}
>
> However, if the data being sent from qx.bom.Request.js = {"people" : "Tom &
> Jerry"}, then kwargs on my server is equal to {' Jerry"}': '', 'data':
> '{"people":"Tom '}
>
> The data on the server side is mangled if the data on the client side has an
> ampersand in it or if it has a semicolon in it. (at least that is what I
> know of so far, there are probably more)
>
> I am probably missing something very simple. I have googled around and
> looked at documentation about unicode, encoding, and character sets and have
> tried many different things, but I do not see why I cannot send an ampersand
> or semicolon in my input data to the server. Obviously, something is
> choking on something.
>
> Please help.
>
> tom
>
>
>
>
>
> tsmiller wrote:
>
>> Jonathon,
>>
>> I display data immediately before the call this.__xmlhttp.send(data) in
>> qx.bom.Request.js in line 300 or so. The data is valid here, but it is
>> corrupt when reaching the server (when a semicolon is in the data).
>>
>> btw, this occurs in Linux and Windows and Chrome and Firefox and IE (and
>> probably everything else).
>>
>> tom
>>
>>
>>
>>
>>
>> Jonathan Weiß-2 wrote:
>>
>>> Hello Tom,
>>>
>>>
>>> I will try to verify this. In advance I have a question: if I read
>>> your server result correctly you get returned an object with the key
>>> data and a long string:
>>>
>>> {
>>> data : "(a long string containing )"
>>> }
>>>
>>> Shouldn't it look more like
>>>
>>> {
>>> data :
>>> {
>>> "session-key":"1252035241-sk",
>>> "store-type":"books",
>>> "online-status":"online",
>>> "store-email":"[email protected]",
>>> "store-name":"featherbottoms",
>>> "store-policies":"now is the time;",
>>> "store-about-info":"About Featherbottoms"
>>> }
>>> }
>>>
>>> ?
>>>
>>> Kind regards
>>> Jonathan
>>>
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day
>>> trial. Simplify your report design, integration and deployment - and
>>> focus on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>>
>>
>
>
--
Christian Schmidt
Software Entwickler
1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
[email protected]
Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver
Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel