Skip to content

JSON.sh cannot parse strings with the character DEL 0x7F inside #46

Description

@nst

Step to reproduce

$ echo $'["\x7F"]' | ./JSON.sh

Expected behaviour

According to RFC 7159, character DEL 0x7F is perfectly valid unescaped.

JSON.sh should parse the string and print:

[0] "\x7F"
[]  ["\x7F"]

Actual behaviour

JSON.sh cannot parse the string and prints an error:

EXPECTED value GOT "

The issue comes from the fact that JSON.sh uses cntrl to recognize control characters in regular expressions, and cntrl includes DEL 0x7F, while JSON control characters (the one that MUST be escaped) only go from U+0000 to U+001F and don't include U+007F.

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