JSON.jl icon indicating copy to clipboard operation
JSON.jl copied to clipboard

Escape unicode character: u2028

Open twavv opened this issue 5 years ago • 2 comments

https://stackoverflow.com/questions/2965293/javascript-parse-error-on-u2028-unicode-character

This is mostly a non issue and only has to do with JS/JSON interop. tl;dr: not all JSON is valid JavaScript. It'd be nice if we replaced the unicode line ending character with the equivalent \u2028 to make the output parseable as JavaScript.

twavv avatar Jul 27 '20 04:07 twavv

Also \u2029: http://timelessrepo.com/json-isnt-a-javascript-subset

Technically, in ECMAScript 2019 (10th edition), it is no longer necessary, since the standard now allows U+2028 and U+2029 in strings. But it's probably better to err on the safe side (probably a lot of non-2019-compatible interpreters still out there) and just escape them. In Documenter we ran into this as well and we apply additional escapes on top of what JSON.json produces.

mortenpi avatar Jul 27 '20 06:07 mortenpi