Case 1: I have a virtual machine with Ubuntu and Tomcat 7.x. If i POST data with special characters to the server i'ts ok. I have a filter that run before any servlet and set the encode to UTF-8 request.setCharacterEncoding("utf-8");
Case 2: In the same virtual machine i have other Tomcat 7.x installation (reply). Now i installed the JOSSO 1.8.6 on Tomcat 7.x. After this when i try to submit POST data with special characters the servlet don't decode correctly request.getParameter("reportText");.
I believe that the JOSSO have any filter that run before my Encode Filter and uses the request what makes my filter request.setCharacterEncoding("utf-8") useless.
What i try to resolve the problem:
- I have set the URIEncoding="utf-8" at the Tomcat Connector tag (server.xml).
- I have used setCharacterEncoding().
- I have set the
JAVA_OPTS="$JAVA_OPTS -Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8"on tomcat setenv.sh - I checked the HTTP Headers and they are correct (Content-Type=text/plain;charset=utf-8)
- I have enable Tomcat filter
setCharacterEncodingFilter
The POST request is generated by client JSP
<form id="xx" name="xx" onsubmit="return validateAndSubmitForm(this);" action="submitReport.do" method="post" enctype="application/x-www-form-urlencoded; charset: utf-8;"> xxx </form>
My JSP tag on top:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
POST headers: image with the headers
Any ideas? Thank you.
I added the
URIEncodingattribute of theConnectorelement of theserver.xmlfile which is the configuration file of tomcat.My code is the following.