jo
jo copied to clipboard
Null character (i.e. "\0") terminates string, but should actually be escaped instead
My understanding of the JSON spec is that the null character (\0
) is a perfectly cromulent character in an JSON string because JSON strings are UTF-8.
A null character in a string apparently terminates the string in jo:
% jo greeting=$'hello \0 world'
{"greeting":"hello "}
Other control control characters get escaped correctly:
% jo greeting=$'hello \1 world'
{"greeting":"hello \u0001 world"}
It's not a problem with the shell handling \0
because this works as expected:
% echo $'hello \0 world'
hello world