Skip to content

Instantly share code, notes, and snippets.

@brunoleles
Last active April 13, 2019 11:29
Show Gist options
  • Save brunoleles/a6e3edc46d5c9ef23fa4cae3fba42dc9 to your computer and use it in GitHub Desktop.
Save brunoleles/a6e3edc46d5c9ef23fa4cae3fba42dc9 to your computer and use it in GitHub Desktop.
Apache + Tomcat ( UTF-8 encoding AND @RequestParam( ) )
<VirtualHost *:80>
...
AddDefaultCharset utf-8
JkOptions +ForwardURIProxy
...
</VirtualHost>
<?xml version='1.0' encoding='utf-8' standalone="no"?>
<Server port="9205" shutdown="SHUTDOWN">
...
<Service name="Catalina">
...
<Connector protocol="HTTP/1.1" ... URIEncoding="UTF-8" /> <!-- for direct tomcat access -->
<Connector protocol="AJP/1.3" ... URIEncoding="UTF-8" /> <!-- for access with apache mod_jk -->
...
</Service>
</Server>
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
...
<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>
<async-supported>true</async-supported>
</filter>
...
<filter-mapping>
<filter-name>setCharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
...
</web-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment