[
https://issues.apache.org/jira/browse/LOG4J2-2097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16237855#comment-16237855
]
Matt Sicker commented on LOG4J2-2097:
-------------------------------------
Looks like I missed that in the RFC initially.
[Link|https://www.ietf.org/rfc/rfc4627.txt]
Relevant snippet:
{noformat}
string = quotation-mark *char quotation-mark
char = unescaped /
escape (
%x22 / ; " quotation mark U+0022
%x5C / ; \ reverse solidus U+005C
%x2F / ; / solidus U+002F
%x62 / ; b backspace U+0008
%x66 / ; f form feed U+000C
%x6E / ; n line feed U+000A
%x72 / ; r carriage return U+000D
%x74 / ; t tab U+0009
%x75 4HEXDIG ) ; uXXXX U+XXXX
escape = %x5C ; \
quotation-mark = %x22 ; "
unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
{noformat}
So it seems like the above listed special characters can use named escapes
rather than unicode ones.
> LogEventPatternConverter JSON implementation should replace newline with \n
> ---------------------------------------------------------------------------
>
> Key: LOG4J2-2097
> URL: https://issues.apache.org/jira/browse/LOG4J2-2097
> Project: Log4j 2
> Issue Type: Bug
> Components: Layouts
> Affects Versions: 2.9.1
> Reporter: Sunny Chan
>
> If you use %enc{%msg}{JSON} and do:
> log.info("Line 1\nLine 2")
> The message will encode as
> "Line 1\u000ALine 2"
> It would be nice if the JSON encoder would replace newline with \n, and if
> the code can recongize other special character would be even better
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)