Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Realtime Messaging Unicode problem

    the SmartGWT or SmartClient version and browser version(s) involved;
    Nightly Build SmartGwtEE Eval 2011-07-28 + Firefox5/Chrome

    I m just using the real time messaging for a very simple function, which is almost the same as the SimpleChat sample. The problem is when unicode characters are transferred via the Messaging.send(...), they all become question marks (?????).

    How can i display unicode correctly?

    Thanks!

    #2
    Make sure that the JVM encoding is UTF-8, and also that the default servlet engine encoding (for whatever engine you're using) is also set to UTF-8.

    Comment


      #3
      Hi, thanks for the reply. The application is for multilingual, so it's been working with UTF8, it can display, save to database, load from database with UTF8 characters without any problem. And also i did System.getProperty("file.encoding") to display the JVM encoding, which returns "UTF-8".

      i m not sure about the servlet engine encoding, but all servlets works fine with UTF8, is there anywhere else i need to configure?

      i also tried to deploy a WAR on tomcat7, but real time messaging still displays UTF8 characters as question marks.

      do i need to explicitly specify the encoding in SmartGwt somewhere?

      Thanks for your help!

      Comment


        #4
        Not in SmartGWT, in the servlet engine. See this Tomcat FAQ.

        Comment


          #5
          Hi Isomophic,

          sorry for my stupidity, could u be more specific about how to configure this?

          i've tried adding 'AddCharset UTF-8' for Apache (/etc/apache2/conf.d/charset), and also change the default charset in Tomcat7, adding the following trunk to $CATALINA_HOME/conf/web.xml

          Code:
          <filter>
          <filter-name>encodingFilter</filter-name>
          <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
          <init-param>
          <param-name>encoding</param-name>
          <param-value>utf-8</param-value>
          </init-param>
          <init-param>
          <param-name>forceEncoding</param-name>
          <param-value>true</param-value>
          </init-param>
          </filter>
          Also have <meta http-equiv="content-type" content="text/html; charset=UTF-8"> in the header part of the project startup HTML file

          it still doesn't work. could u give me more hints? Thanks!

          Comment


            #6
            Another way to force the charset is (as listed in the FAQ) a call to setContentType(). You could add this in a trivial subclass of the MessagingServlet.

            Comment


              #7
              hello.

              I had the same problem.

              look here



              _______________________
              Regards,
              Paata Lominadze.

              Comment


                #8
                We have now corrected this at the servlet level by making MessagingServlet behave like IDACall - ie, we force UTF-8 on all responses unless an init-param directs otherwise. This fix will show up in nightly builds as of tomorrow (Friday August 12)

                Comment

                Working...
                X