title: UTF-8 Encoding doesn't work with Errai and Tomcat
body: <p>we are developing an web application using GWT 2.4, Errai 1.3.2. It is running on Tomcat 6 (6.0.35) and built by Maven (3.0.4).</p>
  
  <p>When running this application on Tomcat, the transfer of special cases is not working. More specific, the request works fine but the response of special characters converts them to �. When using the errai maven archetype, it has the same behaviour. When using GWT-RPC instead of errai RPC, everything works fine. Running the same application in Dev-Mode, the problem doesn't occur.</p>
  
  <p>When looking at the request/response in chrome, both have character encoding UTF-8.</p>
  
  <p>I think this might be an errai bug because there is some String encoding in errai before sending the response.</p>
  
  <p>It would be great, if someone could help me!! It's really a tricky problem...</p>
  
  <p><strong>Thanks, Walter</strong></p>
  
  <hr>
  
  <p>PS: I have already tried the following potential solutions, which all do not work:</p>
  
  <p><strong>Setting index.html head:</strong></p>
  
  <pre><code>&lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
  </code></pre>
  
  <p><strong>Define a custom Servlet Filter</strong></p>
  
  <p>WEB.xml</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;SessionFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;at.apa.excelsa.web.server.SessionFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;requestEncoding&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;SessionFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>Filter.java</p>
  
  <pre><code>public class SessionFilter implements Filter {
  
  String encoding;
  
  @Override
  public void init(FilterConfig filterConfig) throws ServletException {
      encoding = filterConfig.getInitParameter("requestEncoding");
      if (encoding == null) {
          encoding = "UTF-8";
      }
  }
  
  @Override
  public void doFilter(ServletRequest request, ServletResponse response,
          FilterChain chain) throws IOException, ServletException {
  
      if(request.getCharacterEncoding()==null) {
          request.setCharacterEncoding(encoding);
      }
  
      response.setContentType("text/html; charset=UTF-8");
      response.setCharacterEncoding("UTF-8");
  
      chain.doFilter(request, response);
  }
  </code></pre>
  
  <p><strong>On Tomcat Server.xml setting URIEncoding</strong></p>
  
  <pre><code>&lt;Connector port="8080" protocol="HTTP/1.1" 
             connectionTimeout="20000" 
             redirectPort="8443" useBodyEncodingForURI="true" URIEncoding="UTF-8" /&gt;
  </code></pre>
  
  <p><strong>Maven in pom.xml</strong></p>
  
  <pre><code>&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  ...
  &lt;build&gt;
      &lt;outputDirectory&gt;war/WEB-INF/classes&lt;/outputDirectory&gt;
          &lt;plugins&gt;
               &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;gwt-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${gwt.maven}&lt;/version&gt;
                  &lt;configuration&gt;
                      ...
                      &lt;extraJvmArgs&gt;-Xmx512m **-Dfile.encoding=UTF-8**&lt;/extraJvmArgs&gt;
                      ...
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;resources&lt;/goal&gt;
                              &lt;goal&gt;compile&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              ...
  </code></pre>