[
https://issues.apache.org/jira/browse/LOG4J2-255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13658125#comment-13658125
]
Remko Popma commented on LOG4J2-255:
------------------------------------
Analysis:
AbstractStringLayout was constructed with charset "UTF-8".
The actual string is in the platform default encoding, not UTF-8, hence the
scrambled output.
Root cause:
The PatternLayout has a plugin attribute "charset".
The attribute value string is converted to a Charset object with a call to
Charsets.getSupportedCharset(charsetName).
In this method, if the specified charsetName is null, the Charset for UTF-8 is
returned.
Fix: in o.a.l.l.c.helpers.Charsets#getSupportedCharset (line 47),
replace
charset = UTF_8;
with
charset = Charset.defaultCharset();
I'll commit this when I get home tonight.
> Multi-byte character strings are scrambled in log output
> --------------------------------------------------------
>
> Key: LOG4J2-255
> URL: https://issues.apache.org/jira/browse/LOG4J2-255
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders, Core
> Affects Versions: 2.0-beta6
> Reporter: Remko Popma
> Assignee: Remko Popma
> Priority: Blocker
> Fix For: 2.0-beta7
>
>
> When I tried to log a Japanese string the output was scrambled in both the
> Console and a log file.
> For example,
> logger.warn("日本語テスト"); // (Japanese test)
> came out as
> 15:07:00.184 [main] WARN test.JapaneseTest - 譌・譛ャ隱槭ユ繧ケ繝?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]