If your POST and GET parameters are not UTF-8 encoded when using Tomcat 5.x, try to adjust the Connector configuration in Tomcats server.xml like this:

<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
   <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true"
               URIEncoding="UTF-8"
   />
  • No labels

1 Comment

  1. This may work, but you might also have to setup a Filter to set the character encoding on the request before the parameters are parsed. You can use Spring's CharacterEncodingFilter to do this by adding the following to your web.xml. Or by making your own Java filter that sets the CharacterEncoding on the request before the parameters are parsed.

    <filter>
    <filter-name>charsetFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
    <param-name>encoding</param-name>
    <param-value>UTF-8</param-value>
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>charsetFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>