json_fast icon indicating copy to clipboard operation
json_fast copied to clipboard

to-json/pretty: "\uD83C\uDDE9\uD83C\uDDEA" is not pretty

Open dolmen opened this issue 6 years ago • 2 comments

Pretty output is for humans. "\uD83C\uDDE9\uD83C\uDDEA" is not pretty.

What happens:

$ perl6 -MJSON::Fast -e 'say to-json "🇩🇪", :pretty'
"\uD83C\uDDE9\uD83C\uDDEA"

Expected output:

"🇩🇪"

dolmen avatar May 14 '19 13:05 dolmen

i disagree. :pretty json output should still be valid json, as terrible as that is.

timo avatar May 14 '19 14:05 timo

welp, re-reading the multitude of json rfcs i don't understand where i got the impression that anything outside of the basic multilingual plane has to be turned into utf16 surrogate pairs that are then escaped.

timo avatar May 14 '19 14:05 timo