Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nst opened this issue Oct 12, 2016 · 1 comment
Open

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

nst opened this issue Oct 12, 2016 · 1 comment

Comments

@nst
Copy link

nst commented Oct 12, 2016

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.

@dominictarr
Copy link
Owner

so we only need to change this?
https://github.com/dominictarr/JSON.sh/blob/master/JSON.sh#L85-L90

do you want to make a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants