1 Reply Latest reply on Apr 13, 2012 4:03 PM by jobame

    file encoding seems to fail on server

    jobame

      Hello,

       

      with a JSF application I am having a strange problem regarding file encoding which shows up in the browser: language specific letters (e.g. ä, ö, ß) are not printed correctly. The naming is taken from a file "messages_de.properties". Example: the string "Paßwort" from that file is printed as "Paßwort" in the browser. I verified that the file is utf-8 encoded with "file -I messages_de.properties" (on mac) - even when checked directly on the server and not only in the eclipse workspace.

       

      I am using jboss-as-7.1.0.Final and changed the encoding on the server by

       

      1. adding the following options to $JBOSS_HOME/bin/standalone.conf

      JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"

      JAVA_OPTS="$JAVA_OPTS -Dsun.jnu.encoding=UTF-8"

      Result: boot.log shows the options accordingly.

       

      2. adding the following configuration to $JBOSS_HOME/standalone/configuration/standalone.xml

          <system-properties>

              <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>

              <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>

          </system-properties>

      I am not sure whether that is needed at all.

       

      Further actions:

      - I am using eclipse where the encoding is changed completely to utf-8 (but that seems not to be relevant)

      - all xhtml files do have the heading <?xml version="1.0" encoding="UTF-8"?>

      - unfortunately, I couldn't find a way to capture the network traffic on the loopback device. However, the source code of the generated html page seems to indicate that the special characters already have been send wrong by the server.

       

      I am running out of ideas. What could be the reason for the above problem?

       

      Regards,

       

      Michael

        • 1. Re: file encoding seems to fail on server
          jobame

          After a full day of searching and trying out (and posting in this forum) the problem got solved by using the resource bundle editor for eclipse. The file is now us-ascii encoded but special letters (which are not part of that code) are translated automatically, e.g. an ö into \u00F6. As such the encoding doesn't matter anymore. I just hope all encoding problems are now solved