[Simpleweb-Support] Problem decoding "+" characters (%2B)
                
                Brought to you by:
                
                    niallg
                    
                
            
            
        
        
        
    | 
     
      
      
      From: Wilson, T. <TXW...@ea...> - 2007-05-11 00:18:34
      
     
   | 
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
 |