ajax / encoding special characters,and decoding it on the server side

Hello everybody,

I have a problem. I'm working on a web application, using struts, and ajax functions, running on websphere. I have difficulties to transmit special characters (in the 128-159 range, for instance the euro character _ unicode u20AC) to the server, ONLY when they are transmitted via ajax functions.

The enctype of the jsp is ISO-8859-15.

I first tried the javascript escape() method,but websphere was unable to parse the transmitted values, because what is received is %u20AC for the euro character : the % character is indeed not encoded.

In a second time I have tried the javascript encodeURIComponent() method. For the euro character, it gives me %25u20AC; consequently Websphere is able to parse it.

My question is : how to decode it in java ?

Thanks a lot for any answers, and sorry for my poor english !

[869 byte] By [kinski9a] at [2007-11-27 9:19:47]
# 1
perhaps with the URLDecoder class? http://java.sun.com/javase/6/docs/api/java/net/URLDecoder.html
gimbal2a at 2007-7-12 22:12:22 > top of Java-index,Java Essentials,Java Programming...
# 2
If your JSP page expects values to be in ISO-8859-15, the unicode escape sequence will be no good. The euro sign in ISO-8859-15 is code a4 (hex), not 20ac.
quittea at 2007-7-12 22:12:22 > top of Java-index,Java Essentials,Java Programming...
# 3
Hello,Thank you for your answers.In fact I realized that my question was wrong : my problem was not to decode the received values, but to display it in HTML. I managed to do it this morning :).
kinski9a at 2007-7-12 22:12:22 > top of Java-index,Java Essentials,Java Programming...