title: UTF-8 decoding problems in Java & Tomcat7
body: <p>I'm sending an AJAX request to the server, where the param value is encoded in the "escape(...)" function. </p>
  
  <p>The Tomcat server (7.0.42) is configured s.t. the receiving Connector has a URIEncoding="UTF-8", in web.xml I have configured the SetCharacterEncodingFilter as follows:</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;charencode&lt;/filter-name&gt;
      &lt;filter-class&gt;
          org.apache.catalina.filters.SetCharacterEncodingFilter
      &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;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;charencode&lt;/filter-name&gt;
      &lt;url-pattern&gt;*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>, and additionally I have created a filter to encode the response as UTF-8:</p>
  
  <pre><code>@Override
  public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException {
      arg1.setCharacterEncoding("UTF-8");
      arg2.doFilter(arg0, arg1);
  }
  </code></pre>
  
  <p>There is no issue parsing params that come from the Latin charset, but when I tried Russian, request.getParameter(..) returns null. Additionally, I get this in the logs (suspect it's coming from the SetCharacterEncodingFilter):</p>
  
  <pre><code>INFO: Character decoding failed. Parameter [usersaid] with value [%u044B%u0432%u0430%u044B%u0432%u0430%u044B%u0432%u044B%u0432%u0430%u044B%u0432%u0430%21] has been ignored. Note that the name and value quoted here may be corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
  </code></pre>
  
  <p>And there is no DEBUG-level messages to follow (my logger is set up right I believe..)</p>
  
  <p>Could you please advise? Will be happy to answer questions!</p>
  
  <p>Many thanks,
  Victor.</p>