Skip to content

Null character (i.e. "\0") terminates string, but should actually be escaped instead #212

@nicholaides

Description

@nicholaides

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions