1 Reply Latest reply on Feb 20, 2012 7:48 AM by walterp

    Errai and Tomcat have an UTF-8 Problem?

    walterp Newbie



      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).


      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.


      When looking at the request/response in chrome, both have character encoding UTF-8.


      I think this might be an errai bug because there is some String encoding in errai before sending the response.


      It would be great, if someone could help me!! It's really a tricky problem...



      Thanks, Walter




      PS: I have already tried the following potential solutions, which all do not work:



      Setting index.html head:



         <meta http-equiv="content-type" content="text/html; charset=UTF-8">



      Define a custom Servlet Filter























      public class SessionFilter implements Filter {



                String encoding;




                public void init(FilterConfig filterConfig) throws ServletException {

                          encoding = filterConfig.getInitParameter("requestEncoding");

              if (encoding == null) {

                  encoding = "UTF-8";





                public void doFilter(ServletRequest request, ServletResponse response,

                                    FilterChain chain) throws IOException, ServletException {


                          if(request.getCharacterEncoding()==null) {





                          response.setContentType("text/html; charset=UTF-8");



                          chain.doFilter(request, response);




      On Tomcat Server.xml setting URIEncoding


           <Connector port="8080" protocol="HTTP/1.1"


                     redirectPort="8443" useBodyEncodingForURI="true" URIEncoding="UTF-8" />



      Maven in pom.xml













                                                            <extraJvmArgs>-Xmx512m **-Dfile.encoding=UTF-8**</extraJvmArgs>