timo / json_fast

a naive imperative json parser in perl6, to evaluate performance against JSON::Tiny
Artistic License 2.0
26 stars 20 forks source link

Newline etc, escaping bug. #35

Closed dwarring closed 6 years ago

dwarring commented 6 years ago
% perl6 -v
This is Rakudo version 2017.12-88-g8fd776fd7 built on MoarVM version 2017.12-15-g8414888b implementing Perl 6.c.
% perl6 -I ../json_fast/lib/ -MJSON::Fast -e'say from-json(q<"AB\nC">).perl'
"AB\nC"
% perl6 -I ../json_fast/lib/ -MJSON::Fast -e'say from-json(q<"AB\nC\u000A">).perl'
"ABnC\n"

Note the decoding of \n as n, but only if '\nand\u000A` are used together in a string.

New regression in JSON::Fast 0.9.9.

m-dango commented 6 years ago

It's looking like any use of \u and \n together in the same string is breaking newlines in 0.9.9

$ perl6 -e 'use JSON::Fast:ver<0.9.8>; dd from-json(‘{"test":"\n backslash u: \u2605 \n","test2":"\n no backslash u: ★ \n"}’)'
${:test("\n backslash u: ★ \n"), :test2("\n no backslash u: ★ \n")}

$ perl6 -e 'use JSON::Fast:ver<0.9.9>; dd from-json(‘{"test":"\n backslash u: \u2605 \n","test2":"\n no backslash u: ★ \n"}’)'
${:test("n backslash u: ★ n"), :test2("\n no backslash u: ★ \n")}
zoffixznet commented 6 years ago

Possibly related to https://github.com/timo/json_fast/issues/36

timo commented 6 years ago

i believe i fixed this in release 0.9.10; please try it on your real-life datasets

dwarring commented 6 years ago

Now working. Thanks.