Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions JSON.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:]"\\]|)'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pay no attention to the UTF-8 behind the curtain...

image

else
GREP=awk_egrep
ESCAPE='(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR='[^[:cntrl:]"\\\\]'
CHAR='([^[:cntrl:]"\\\\]|\x7F)'
fi

local STRING="\"$CHAR*($ESCAPE$CHAR*)*\""
Expand Down
1 change: 1 addition & 0 deletions test/valid/string_with_unescaped_chars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"₀򂂀𝌆"
1 change: 1 addition & 0 deletions test/valid/string_with_unescaped_chars.parsed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[] "₀򂂀𝌆"