Tomcat: Force UTF-8 Encoding for Special Character Handling

  • 7011206
  • 12-Dec-2011
  • 09-Jul-2013

Environment


NetIQ Access Governance Suite 6

Resolution

When an installation is using a Tomcat Application Server and needs to be able to provision accounts with usernames or passwords containing special characters (example: passüword), the following filter text must be added to the <IIQ Path>/WEB-INF/web.xml file to force the UTF-8 character set to be used everywhere.  (Note: This filter has been added by default to the web.xml file as of release 5.5.) 

<filter>
 <filter-name>characterEncodingFilter</filter-name>
 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
 <init-param> 
  <param-name>forceEncoding</param-name>
  <param-value>true</param-value>
 </init-param>
 <init-param>
  <param-name>encoding</param-name>
  <param-value>UTF-8</param-value>
 </init-param>
</filter>
<filter-mapping>
 <filter-name>characterEncodingFilter</filter-name>
 <url-pattern>/*</url-pattern>
</filter-mapping>

After adding this to the web.xml file, stop and restart the application server to put the change into effect.

This filter is only required for Tomcat application servers, though it works with other application servers as well. This is Apache's recommended method for handling character encoding issues, as described on the apache.org Tomcat wiki.

Feedback service temporarily unavailable. For content questions or problems, please contact Support.