davisp / jiffy

JSON NIFs for Erlang
Other
869 stars 319 forks source link

Fix \r and \n not supported in JSON value #202

Closed terry-xiaoyu closed 4 years ago

terry-xiaoyu commented 4 years ago

This PR fixes the issue that jiffy cannot decode strings that contains \n (int 10) \r (int 13) characters:

(emqx@127.0.0.1)4> jiffy:decode(<<"[\"a\n\"]">>, []).
** exception error: {4,invalid_string}
     in function  jiffy:decode/2 (/Users/emqer/code/emqx-rel/_checkouts/jiffy/src/jiffy.erl, line 71)

The example above should return [<<"a\n">>].

terry-xiaoyu commented 4 years ago

May not an issue according to https://tools.ietf.org/html/rfc8259#section-7 .

Close the PR.