THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- Set the
URIEncoding
attribute on the <Connector> element in server.xml to something specific (e.g.URIEncoding="UTF-8"
). - Set the
useBodyEncodingForURI
attribute on the <Connector> element in server.xml totrue
. This will cause the Connector to use the request body's encoding for GET parameters.
References: Tomcat 6 7 HTTP Connector, Tomcat 6 7 AJP Connector
Anchor | ||||
---|---|---|---|---|
|
...
- Set
URIEncoding="UTF-8"
on your <Connector> inserver.xml
. References: HTTP Connector, AJP Connector. - Use a character encoding filter with the default encoding set to UTF-8
- Change all your JSPs to include charset name in their contentType. For example, use
<%@page contentType="text/html; charset=UTF-8" %>
for the usual JSP pages and<jsp:directive.page contentType="text/html; charset=UTF-8" />
for the pages in XML syntax (aka JSP Documents). - Change all your servlets to set the content type for responses and to include charset name in the content type to be UTF-8. Use
response.setContentType("text/html; charset=UTF-8")
orresponse.setCharacterEncoding("UTF-8")
. - Change any content-generation libraries you use (Velocity, Freemarker, etc.) to use UTF-8 and to specify UTF-8 in the content type of the responses that they generate.
- Disable any valves or filters that may read request parameters before your character encoding filter or jsp page has a chance to set the encoding to UTF-8. For more information see http://www.mail-archive.com/users@tomcat.apache.org/msg21117.html.
...