Im working on a Flex-Java (Client-Server) application and Im stuck on a problem. Im sending to the server path parameters and receiving them on a JSP, sometimes, those parameters have special characters like áéíóú or ñ. I have what I think is a common problem, those special characters are being wrong received on my server.
I also checked out another questions having the same isuue like this one or this other.
I have already tried to use request.setCharacterEncoding("UTF-8")
for receiving the params (answer from first question).
I also tried checking the configuration of my server (Apache Tomcat 7.0.34.0) on the server.xml file and Im sure that the node with port 8080 has the URIEncoding="UTF-8"
attribute (answer from second question).
I even tried reading the param like:
String paramTest1 = (new String(request.getParameter("paramTest").getBytes("ISO-8859-1"),"UTF-8"));
or
String paramTest2 = (new String(request.getParameter("paramTest").getBytes("UTF-8")));
Debugging my app I realized that the URI was well-received, the problem is on the moment I read the parameters from the request.
Currently I receive the parameters by the tradicional way, the code of my JSP:
<%@page contentType="text/html" pageEncoding="UTF-8" language = "java"%>
<%
request.setCharacterEncoding("UTF-8");
String paramTest = request.getParameter("paramTest");
String paramTest1 = (new String(request.getParameter("paramTest").getBytes("ISO-8859-1"),"UTF-8"));
String paramTest2 = (new String(request.getParameter("paramTest").getBytes("UTF-8")));
%>
As in the image can be apreciated Im sending the String "1234acentoáéíóúeñe" for the paramTest parameter. The values of my vars obtaining the parameteres are:
paramTest = 1234acento�����
paramTest1 = 1234acento?????
paramTest2 = 1234acento�����
And I need to receive exactly the same characters that Im sending.
Dont know if it is important to say but on the Flex side, for the URLRequest object Im specifying a URLRequestHeader object ("Content-Type", "text/html;charset=UTF-8")
for the requestHeaders Araray. That doesn't hel for my purpose.
Any comment or answer is well appreciated.
Thanks.