Setting Java Environment (Apache Tomcat) to encode UTF-8
You have a few general settings with different impact levels:
(1) Configure your JSP
page to display content in utf-8 (place on top of jsp page)
<%@page pageEncoding="utf-8" %>
(2) Set default character encoding to utf-8 (java system property)
-Dfile.encoding="utf-8"
(3) Configure your application server to encode request parameters in utf-8 (in conf/server.xml)
<connector .... URIEncoding="utf-8" />
(4) Tell browser content is in utf-8 (place in html HEAD
section)
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
You must to edit the /config/web.xml uncomment this filter: setCharacterEncodingFilter
<!-- A filter that sets character encoding that is used to decode -->
<!-- parameters in a POST request -->
<filter>
<filter-name>setCharacterEncodingFilter</filter-name>
<filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<!-- The mapping for the Set Character Encoding Filter -->
<filter-mapping>
<filter-name>setCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
In within your project directory: You must have a folder named 'font' in this foler copy the arabic fonts , this will carry your path to characters on server too....
精彩评论