-
Notifications
You must be signed in to change notification settings - Fork 12
Invalid parsing of escaped unicode values #2
Comments
Further testing shows that in // ...
rvalidsolidus = /\\("|\\|\/|b|f|n|r|t|u[0-9]{4})/, // original version
rvalidsolidus = /\\("|\\|\/|b|f|n|r|t|u[0-9]+)/, // my change Edit: regex demo showing that the |
Just figured out why it invalidates and it's because the regex is ONLY listening for numeric unicode values... Updating // ...
rvalidsolidus = /\\("|\\|\/|b|f|n|r|t|u[0-9]{4})/, // original version
rvalidsolidus = /\\("|\\|\/|b|f|n|r|t|u[0-9A-F]{4})/i, // my change
// > catches \u1234 AND \u12aE |
@codenothing I just finished updating the test on my fork and it passes. I had to modify the In reading up on Unicode spec, under Architecture and terminology, it specifies that the Basic Multilingual Plane occupies the range of In any case, this is a pretty involved issue, because I have no idea what your goal was in supporting a particular unicode spec and how robust the validation of that should be? And so you can review my changes made here (https://github.com/bmcminn/jsonlint) and see what you think, though I plan to issue a pull request to resolve this issue. EDIT: Pull request issued #3 |
Finally have a spec to reference for implementation validation: http://rfc7159.net/rfc7159#unichars |
Currently using this library in a Grunt task, and ran into the following issue:
Just tested the above snippet against jsonlint.com, jsonlint pro, and jsoneditoronline and they all infer the unicode characters and parse as valid JSON data.
This snippet exists in a much deeper part of my JSON data that is compiled via PHP's
json_encode
function, however the raw escaped unicode values cause this linter to throw the above error.Escaping the reverse solidus [
"\\u2117 & \\u00a9 2014 {{sitename}}"
] "fixes" the issue; though it seems inconvenient as most systems escape unicode values in this fashion by default.The text was updated successfully, but these errors were encountered: