| Author |
Problem with URLEncoder.encode and request.getparameter with chinese characters
|
Shah Jenish
Greenhorn
Joined: Feb 19, 2009
Posts: 13
|
|
This is the URL that I use to invoke my servlet from my applet
Code:
http://192.168.0.67/MyServlet?p1=団
As you can see, the parameter has a unicode character 団. So I use
Code:
URLEncoder.encode ( "団", "UTF-8" ) ;
and now my URL becomes
Code:
http://192.168.0.67/MyServlet?p1=%E5%9B%A3
However, from the servlet, calling
Code:
request.getParameter ( "p1" ) ;
already return some gibberish that cannot be decoded with URLDecoder. BTW, invoking
Code:
URLDecoder.decode ( "%E5%9B%A3", "UTF-8" ) ;
does give me the original unicode character. It`s just that the servlet has garbled the parameter before it can even be decoded. Does anyone know why?
Request.gerparameter doesnt decode parameter with UTF-8?
|
 |
veda bandaru
Greenhorn
Joined: Sep 14, 2006
Posts: 3
|
|
Hi,
You need to translate the character set of the parameter
Ex:
Its just an example iso code, you need to find the correct one for Chinese.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Problem with URLEncoder.encode and request.getparameter with chinese characters
|
|
|