wood burning stoves 2.0*
The moose likes Servlets and the fly likes Incoming Parameter Value Encoding Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Incoming Parameter Value Encoding Problem" Watch "Incoming Parameter Value Encoding Problem" New topic
Author

Incoming Parameter Value Encoding Problem

steve nacosta
Greenhorn

Joined: Nov 11, 2009
Posts: 8
hi,

i am receiving some request from other servlet,

url in the browser shows,
http://localhost:8080/....../DemoServlet?sign=q4ZuW4ubPu2axXcAj9kHy%2B3cKHIxXfStgyFTw5/cNKlr5%2B%2B%2BK/LI68QxDYqOVHUoV&exp=05/2015&.....


i want the 'sign' parameter value in my servlet as its shown in url which is,
"q4ZuW4ubPu2axXcAj9kHy%2B3cKHIxXfStgyFTw5/cNKlr5%2B%2B%2BK/LI68QxDYqOVHUoV"


now in my servlet DemoServlet, i am trying to get the 'sign' parameter value,
String sign=URLEncoder.encode(request.getParameter("sign"),"UTF-8");

which actually assign sign="q4ZuW4ubPu2axXcAj9kHy%2B3cKHIxXfStgyFTw5%2FcNKlr5%2B%2B%2BK%2FLI68QxDYqOVHUoV"

that is the value that i don't want,
the difference in url and string is all the '/' are in form of hexa value '%2F',

how can i get the correct value,
please suggest.


-Thanks

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

If you don't want the encoded value, why are you encoding it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
steve nacosta
Greenhorn

Joined: Nov 11, 2009
Posts: 8
Bear Bibeault wrote:If you don't want the encoded value, why are you encoding it?


thanks for your reply.

actually without encoding i am getting the string that is even worst...

never the less,i managed to make some function which convert %2F --> '/' .





Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

You shouldn't have to do any conversions. You should be fixing the real problem rather than applying a band aid.
steve nacosta
Greenhorn

Joined: Nov 11, 2009
Posts: 8
ok i'll do it.

Thanks...
 
 
subject: Incoming Parameter Value Encoding Problem
 
Similar Threads
HttpURLConnection seems to be doing some level of URL Decoding.
problem with request parameter
Redirect from servlet to EXTERNAL URL using POST
request.getParameter() problem
how to pass a parameter in the query string with the '+' sign in it unchanged.