title: Spring MVC 3.1 - Request Header Character Encoding issue [UTF-8]
body: <p>I'm trying to get file name from request header, I'm getting character encoding problem despite I have defined <strong>Spring encoding filter in my web.xml</strong>.</p>
  
  <pre><code>String fileName = request.getHeader("X-File-Name"); // wrong encoding
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>        &lt;filter-name&gt;CharacterEncodingFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;encoding&lt;/param-name&gt;
              &lt;param-value&gt;UTF-8&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;forceEncoding&lt;/param-name&gt;
              &lt;param-value&gt;true&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;CharacterEncodingFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>Also I've added <code>URIEncoding="UTF-8"</code> config into Tomcat server.xml file.
  And added same config JAVA_OPTS too.</p>
  
  <pre><code>-DuriEncoding=UTF-8 -Dfile.encoding=UTF-8
  </code></pre>