Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arabic encoding

Tags:

java

jsp

arabic

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 ?

like image 935
Moon123 Avatar asked Mar 07 '26 09:03

Moon123


1 Answers

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.

like image 189
Paulius Matulionis Avatar answered Mar 08 '26 21:03

Paulius Matulionis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!