[ 
https://issues.apache.org/jira/browse/LOG4J2-518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13883987#comment-13883987
 ] 

Remko Popma commented on LOG4J2-518:
------------------------------------

I cannot reproduce the problem with this code:
{code}
// \u65e5\u672c\u8a9e = 日本語
// \u30c6\u30b9\u30c8 = テスト
// \u6f22\u5b57 = 漢字
Logger log = LogManager.getLogger(PatternTestUTF8.class);
List<String> list = Arrays.asList("a", "\u65e5\u672c\u8a9e", "b", 
"\u30c6\u30b9\u30c8", "c", "\u6f22\u5b57");
List<List<String>> listOfList = Arrays.asList(list, list);
log.info(listOfList);
log.info(list);
log.info(list.get(1));
{code}

I'm on Japanese windows, perhaps that is why I cannot reproduce the problem. 
Here is what I'm seeing:

If I use the config you suggested ({{<charset>UTF-8</charset>}}), then I get 
scrambled text, because my default encoding is MS932. If I change the config to 
{{<charset>MS932</charset>}} then I see the correct Japanese for all three log 
lines (nested list, straight list, list element)...

Can you reproduce the problem with the code above?
If you are getting your list from a database, it is possible that the database 
values are not UTF-8 encoded...


> Logging of nested list uses incorrect charset
> ---------------------------------------------
>
>                 Key: LOG4J2-518
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-518
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders, Layouts
>    Affects Versions: 2.0-beta9
>         Environment: Windows 7
>            Reporter: Brian
>            Priority: Minor
>              Labels: list, utf-8
>
> When I log a list that contains UTF-8 (japanese characters) it works fine and 
> displays correctly in the console.  However, when this list is nested in 
> another list, it displays boxes with question marks.  When I copy and paste 
> these characters elsewhere they display correctly.
> E.g.:
>    LOG.info("Data columns: ");
>    LOG.info(dataColumns);
> gives:
>    INFO c.m.s.r.t.f.d.ListDataLoaderTest [main] [[phrase, phrase, phrase, 
> phrase, phrase ??????, phrase, ??????????, ...
> (where "?" are surrounded by boxes in my actual console output)
>         
> But:
>    LOG.info("Phrases: ");
>    LOG.info(dataColumns.get(0));
> gives:
>    [phrase, phrase, phrase, phrase, phrase モーター制御, phrase, ポップアップメニュー, 
> (i.e., the correct Japanese).
> Appender used:
> {code}
>    <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout>
>          <pattern>%p %C{1.} [%t] %m%n</pattern>
>          <charset>UTF-8</charset>
>       </PatternLayout>
>    </Console>
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to