| Author |
HttpServletRequest getReader() - encoding problem
|
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
To overcome the problem of receiving request POST parameters with chunked transfer encoding, I am using the following code...
...to obtain the paramsString.
One of the parameter values being sent is an email address, but the "@" symbol is turned into "%40".
Presumably, request.getReader() is using the wrong encoding, but how do I solve it? I have tried calling request.setCharacterEncoding("UTF-8") before calling request.getReader(), but it doesn't solve.
Anyone have any ideas?
|
 |
Nishan Patel
Ranch Hand
Joined: Sep 07, 2008
Posts: 676
|
|
As you told post data why you are using request.getReader(). From the jsp page you can get using request.getParameter("Email String");
what is the reason behind use this..
|
Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
|
The problem with using request.getParameter() is that if the request parameters are sent in chunks then you may only get the first chunk and so won't be able to access the parameters/values in subsequent chunks. That is why I use request.getReader().
|
 |
James Hodgkiss
Ranch Hand
Joined: Jan 22, 2004
Posts: 401
|
|
The problem was the the request was coming from an html form.
I added this line at the end of my code snippet, and now it works fine...
Cheers,
James
|
 |
 |
|
|
subject: HttpServletRequest getReader() - encoding problem
|
|
|