Re: [Simpleweb-Support] Problem decoding "+" characters (%2B)
Brought to you by:
niallg
From: Wilson, T. <TXW...@ea...> - 2007-05-11 18:29:06
|
Niall, =20 Thanks for looking into this! And yes, I am just submitting a GET request with curl and then looking at the parameters in the request object through a debugger. Here is another example, if I pass in the parameter val=3D%5B%2B%24 (that is "[+$"), here's what I see in the debugger: =20 request.getParameters().toString() =3D "%5B+%24" - This is the confusing part. This means that %2B has already been decoded to + in the parser's internal buffer, right? Why would %2B be treated differently from other percent encodings? =20 Request.getParameters().getParameter() =3D "[ $" - Now the whole string gets decoded and the plus (quite correctly) gets decoded in to a space. =20 Do you think there could be something I'm doing to cause %2B to be decoded "before it's time"? I did confirm with a packet sniffer that %2B is sent out over the wire, so the client isn't messing it up. =20 =20 Thanks, =20 Terry =20 =20 ________________________________ From: sim...@li... [mailto:sim...@li...] On Behalf Of Niall Gallagher Sent: Friday, May 11, 2007 9:38 AM To: Simple support and user issues Subject: Re: [Simpleweb-Support] Problem decoding "+" characters (%2B) =20 Hi, This seems quite strange, I am sure I have tested this case many times. I have also taken a look at the URIParser and it does not decode the query, it simple spots the '?' and hands it off to the ParameterParser, which then decodes it. What exactly are you doing to create this scenario? Are you simply performing a Request.getParameter(name) from a POST or GET? Niall ----- Original Message ---- From: "Wilson, Terry" <TXW...@ea...> To: sim...@li... Sent: Friday, May 11, 2007 1:18:30 AM Subject: [Simpleweb-Support] Problem decoding "+" characters (%2B) Hello, =20 I'm having trouble sending the plus (+) character from a client to a simple (3.1.3) server. I'm hoping someone could point out what I'm doing wrong :-) =20 My understanding is that the plus character needs to be percent encoded by the client to this: %2B =20 So let's take this URL: http://server?val=3D%2B =20 When I send that to the server and print out the Parameters object I get from the request I see this: =20 val=3D+ =20 Looks good so far, %2B has been decoded into a "+" character. When I try to get the value with parameters.getParameter("val"), what I get back is a space (" "). The javadoc for ParameterParser mentions that the "+" character is replaced with a space, so I know this is done intentionally. Looks like the URL is first decoded into the parameters object and then this special rule is applied when retrieving individual parameter values. =20 But what if I actually need to get a plus character through? I thought that the "+" character is just shorthand for the space encoding of %20. Why is this plus character rule being applied after the decoding has already taken place? =20 I might just be confused and this works exactly as it should :-) If that is the case how is a client supposed to pass in a plus character value? I've tried various ways of encoding, but I haven't been able to get a plus sign to appear in the string I get from the getParameter(string) call. =20 =20 Thanks and any help appreciated, =20 Terry =20 =20 ------------------------------------------------------------------------ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Simpleweb-Support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpleweb-support =20 =20 ________________________________ Need a vacation? Get great deals to amazing places <http://us.rd.yahoo.com/evt=3D48256/*http:/travel.yahoo.com/;_ylc=3DX3oDM= TFh N2hucjlpBF9TAzk3NDA3NTg5BHBvcwM1BHNlYwNncm91cHMEc2xrA2VtYWlsLW5jbQ--> on Yahoo! Travel.=20 |