[
https://issues.apache.org/jira/browse/FELIX-5555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15874411#comment-15874411
]
Julian Reschke commented on FELIX-5555:
---------------------------------------
Indeed, see <https://greenbytes.de/tech/webdav/rfc7159.html#rfc.section.7>:
{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}
> JSONParser is not handling escape char properly
> -----------------------------------------------
>
> Key: FELIX-5555
> URL: https://issues.apache.org/jira/browse/FELIX-5555
> Project: Felix
> Issue Type: Bug
> Components: Utils
> Affects Versions: utils-1.9.0
> Reporter: Chetan Mehrotra
> Fix For: utils-1.9.2
>
>
> {{JSONWriter}} currently adds an escape char for '/'. So "foo=/bar" is
> rendered as
> {noformat}
> {"foo":"\/bar"}
> {noformat}
> When such a json is read via {{JSONParser}} then the '\' is not removed
> Following test fails
> {code}
> @Test
> public void escapeChar() throws Exception{
> StringWriter sw = new StringWriter();
> JSONWriter js = new JSONWriter(sw);
> js.object().key("foo").value("/bar").endObject().flush();
>
> JSONParser jp = new JSONParser(sw.toString());
> assertEquals("/bar", jp.getParsed().get("foo"));
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)