Unicode characters in URL

V

Vijay

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...
 
M

Mickey Segal

Vijay said:
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.

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?
 
V

Vijay

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,
 
M

Mickey Segal

Vijay said:
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?

Perhaps others will be more familiar with the details of your environment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top