I am doing a simple ajax call with the YahooUI Javascript library as follows:
YAHOO.util.Connect.setForm('myform');
YAHOO.util.Connect.asyncRequest('POST', url, ...);
Following are the settings in my app: Tomcat version: 6.0.18
Tomcat server connector : URIEncoding="UTF-8" webapp page :
Also stated in YahooUI connector library docs:
setForm will encode each HTML form field's name and value using encodeURIComponent. This results in a string of UTF-8 encoded, name-value pairs. NOTE: Setting an HTTP header of "Content-Type" with a different charset value will not change the encoding of the serialized data.encoding of the serialized data.
I can see that the french characters that are being sent as parameters are encoded (in ie7 using iehttpheader tool):
name=%C3%88%C3%A0%C3%B4
testParam=%C3%B4%C3%B4
For the data : name: Èàô and testParam: ôô
But on the server side I am seeing values as following: ÈàÃÂ
Even if I am converting the string to bytes and then create new string with the charset defined as follows: String val = new String(oo.getBytes("UTF-8")); I am not able to get the exact data as expected.
Note: I have referenced the question below, but was not able to resolve this issue: http://stackoverflow.com/questions/138948/how-to-get-utf-8-working-in-java-webapps Please guide.
UPDATE: Calling the decode UTF-8 function as given on W3.org site http://www.w3.org/International/O-URL-code.html is giving me the expected results. I expect Tomcat to be decoding this?.