https://bz.apache.org/bugzilla/show_bug.cgi?id=63792

            Bug ID: 63792
           Summary: The tomcat log contains garbled code because of i18n
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Util
          Assignee: dev@tomcat.apache.org
          Reporter: lgxbs...@gmail.com
  Target Milestone: -----

The tomcat log contains garbled code which is hard to read because of i18n. If
tomcat is running in China, an example log(tomcat start log) is shown below.

Actual log:
01-Oct-2019 13:54:06.909 信息 [main] org.apache.coyote.AbstractProtocol.start
å¼å§åè®®å¤çå¥æ["http-nio-8080"]
01-Oct-2019 13:54:06.925 信息 [main] org.apache.coyote.AbstractProtocol.start
å¼å§åè®®å¤çå¥æ["ajp-nio-8009"]

Expected log:
01-Oct-2019 14:15:21.385 信息 [main] org.apache.coyote.AbstractProtocol.start
开始协议处理句柄["http-nio-8080"]
01-Oct-2019 14:15:21.397 信息 [main] org.apache.coyote.AbstractProtocol.start
开始协议处理句柄["ajp-nio-8009"]

It is caused by org.apache.tomcat.util.res.StringManager#getString and
java.util.PropertyResourceBundle. Prior to java 9, the PropertyResourceBundle
loads properties using encoding ISO-8859-1. The encoding ISO-8859-1 can only
represent the Latin letters, not all characters. When we use languages which
are not based on Latin letters, such as Chinese, the garbled codes appear. 

Fortunately, Java 9 and later version fix this issue by using UTF-8 instead of
ISO-8859-1 by default. Tomcat should address this issue when users use previous
version of Java 9. This issue affects branch 7.0.x, 8.5.x, 9.0.x and all the
tomcat releases after i18n. I will submit a pull request later to fix it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to