I have a simple web application which consists of Servlets and JSPs. In one JSP, data is entered to be sent to a Servlet where the Servlet interacts with the back-end to save data in a DB (MySQL).
My problem is that the data is in Arabic, hence i set the page directive with the UTF-8 encoding and added a filter to set both request and response encoding to utf-8 but i still get rubbish data from the JSP to the Servlet.
Note that I am using Apache Tomcat Server v6.0, do you have any idea where is my problem ?
By default, Tomcat uses ISO-8859-1 character encoding when decoding URLs received from a browser. You have to make sure that your tomcat's server.xml's file connector element has URIEncoding attribute which value is UTF-8:
<Connector port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
redirectPort="8443"/>
Take a look here for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With