6 Replies Latest reply on Jul 30, 2010 6:45 AM by jfclere

    Tomcat encoding

    jidehem

      I'm using JBoss on a server with french locale.
      All the pages displayed (JSP, servlets) are displaying correctly.
      However, the error pages have a strange encoding (it is (correctly) interpreted by firefox as UTF-8).
      For example, the 404 error page displays:

      Etat HTTP 404 - /SIT/index.j

      type Rapport d'�tat

      message /SIT/index.j

      description La ressource demand�e (/SIT/index.j) n'est pas disponible.
      JBoss Web/2.1.3.GA


      Thus it seems all pages directly generated by tomcat have the wrong encoding (encoded twice ?).

      The logs from JBoss about tomcat shows the same behaviour:

      13:53:11,780 INFO [Http11Protocol] D�marrage de Coyote HTTP/1.1 sur http-localhost%2F127.0.0.1-8080
      13:53:11,858 INFO [Http11Protocol] D�marrage de Coyote HTTP/1.1 sur http-localhost%2F127.0.0.1-8443


      Note: previewing this post, the special characters are re-interpreted and doesn't look the same as displayed in firefox.

        • 1. Re: Tomcat encoding
          jfclere

          According to a quick try:
          +++
          curl -v http://localhost:8080/toto
          ...
          < HTTP/1.1 404 Not Found
          < Server: Apache-Coyote/1.1
          < Content-Type: text/html;charset=utf-8
          < Content-Length: 975
          +++

          What headers are you getting?

          • 2. Re: Tomcat encoding
            jidehem

            Trying the same as you:
            +++
            curl -v http://localhost:8080/toto
            ...
            < HTTP/1.1 404 Introuvable
            < Server: Apache-Coyote/1.1
            < Content-Type: text/html;charset=utf-8
            < Content-Length: 979
            < Date: Tue, 01 Sep 2009 07:16:27 GMT
            <
            +++

            Thus it is the same result as for you.

            Only the body of the response is wrongly encoded.
            For example, the e acutes (é) are replaced by the following 6 hexadecimal characters : C3 AF C2 BF C2 BD.

            • 3. Re: Tomcat encoding
              jidehem

              Finally, I found that the problem was with the french localization properties files.

              They are badly encoded in JBoss Web 2.1.3.GA (and I think version 2.1.x are affected until 2.1.4).

              Fixing the property file solved this problem.

               

              About JBoss Web 2.1.3.GA, I couldn't find where to download it's sources and binaries. The version used came with JBoss AS 5.1.0.GA.

              I only found that the project changelog doesn't talk about 2.1.4.GA but the download section has a links to it.

              Did version 2.1.3.GA exist in the JBoss Web project ?

              • 4. Re: Tomcat encoding
                jfclere

                I have arranged the JBossWeb pages and upload the latest 2.1.x version.

                Could you please try with 2.1.9.GA?

                 

                The 2.1.3.GA wasn't published.

                • 5. Re: Tomcat encoding
                  jidehem

                  Thanks for the quick reply and updates !

                   

                  I tried to use JBoss Web 2.1.9.GA, but didn't find how to integrate it in JBoss AS 5.1.0.GA (whose error messages tell it's using JBoss Web 2.1.3.GA).

                  Is it really JBoss Web which is bundled into JBoss AS (there is only a subset of JBoss Web library names in it (like servlet/jsp/el-api.jar)) ?

                  How to update it ?

                  • 6. Re: Tomcat encoding
                    jfclere

                    Get a subscription and you will have it

                     

                    You can also compile JBossWeb and copy the jbossweb.jar to the jbossweb.jar(s) of the JBoss AS 5.1.0.GA.