hi all,
I have a servlet which takes in a name in the URL.
http://localhost/myServlet.123?name=blah
When this name contains unicode characters, then my ActionForm gets
different characters, not the ones posted. (On the status bar of IE6.0,
I can see that the URL contains the right value of the name). It seems,
while transmitting the get request, the name's value gets changed.
In the form's post request, everything works well.
Can anybody point out what is wrong here?
Thanks for any help...
Mickey Segal - 20 Jun 2005 21:07 GMT
> I have a servlet which takes in a name in the URL.
> http://localhost/myServlet.123?name=blah
[quoted text clipped - 3 lines]
> I can see that the URL contains the right value of the name). It seems,
> while transmitting the get request, the name's value gets changed.
Are you doing both URL and UTF encoding for output going to the servlet?
Are you using something like:
req.setCharacterEncoding("UTF-8");
in the receiving servlet?
Vijay - 21 Jun 2005 09:36 GMT
hi Segal,
java.net.URLDecoder.decode("%E6%AC%80%E6%AC%A8%E6%AD%81%E6%AB%BB%E6%AC%B8%E6%AD%A7.doc","UTF-8")
gives me the right value for the name.
However, it seems that when struts populates the name field in the
ActionForm, it is not using the UTF-8 Encoding. I have also specified
UTF-8 encoding using request.setCharacterEncoding("UTF-8"). Is there a
workaround for this?
Thanks,
Mickey Segal - 21 Jun 2005 14:28 GMT
> hi Segal,
>
[quoted text clipped - 5 lines]
> UTF-8 encoding using request.setCharacterEncoding("UTF-8"). Is there a
> workaround for this?
Perhaps others will be more familiar with the details of your environment.