sile / jsone

Erlang JSON library
MIT License
291 stars 72 forks source link

New line encoded chars are not decoded properly #31

Closed silviucpp closed 6 years ago

silviucpp commented 6 years ago

Try to decode the following

<<"{\"to\":\"Jon Doe\",\"text\":\"Hello John,\n\nVisit me to renew.\"}">>

Error:

exception error: bad argument
     in function  jsone_decode:string/6
        called as jsone_decode:string(<<"\n\nVisit me to renew.\"}">>,
                                      <<"Hello John,\n\nVisit me to renew.\"}">>,
                                      0,
                                      [{object_next,<<"text">>,
                                        [{<<"to">>,<<"Jon Doe">>}]}],
                                      <<>>,
                                      {decode_opt_v2,proplist,false,binary,
                                       false})
     in call from jsone:decode/2 (src/jsone.erl, line 293)
silviucpp commented 6 years ago

Ohh I see I need to use {allow_ctrl_chars, true} for proper decodeing