From eadcad4010b84e58cf91e382eba3823d457274d7 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Wed, 26 Oct 2016 23:29:17 -0400 Subject: [PATCH] Accept unescaped U+007F DELETE per RFC 7159 Fixes gh-46 --- JSON.sh | 4 ++-- test/valid/string_with_unescaped_chars.json | 1 + test/valid/string_with_unescaped_chars.parsed | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 test/valid/string_with_unescaped_chars.json create mode 100644 test/valid/string_with_unescaped_chars.parsed diff --git a/JSON.sh b/JSON.sh index 0778633..19cdc6b 100755 --- a/JSON.sh +++ b/JSON.sh @@ -83,11 +83,11 @@ tokenize () { if echo "test string" | egrep -o "test" >/dev/null 2>&1 then ESCAPE='(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' - CHAR='[^[:cntrl:]"\\]' + CHAR='([^[:cntrl:]"\\]|)' else GREP=awk_egrep ESCAPE='(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})' - CHAR='[^[:cntrl:]"\\\\]' + CHAR='([^[:cntrl:]"\\\\]|\x7F)' fi local STRING="\"$CHAR*($ESCAPE$CHAR*)*\"" diff --git a/test/valid/string_with_unescaped_chars.json b/test/valid/string_with_unescaped_chars.json new file mode 100644 index 0000000..37c30dd --- /dev/null +++ b/test/valid/string_with_unescaped_chars.json @@ -0,0 +1 @@ +"₀򂂀𝌆" diff --git a/test/valid/string_with_unescaped_chars.parsed b/test/valid/string_with_unescaped_chars.parsed new file mode 100644 index 0000000..422bae5 --- /dev/null +++ b/test/valid/string_with_unescaped_chars.parsed @@ -0,0 +1 @@ +[] "₀򂂀𝌆"