Stricter JSON standard conformance#2153
Merged
aleks-f merged 1 commit intopocoproject:developfrom Feb 13, 2018
Merged
Conversation
aleks-f
pushed a commit
that referenced
this pull request
Feb 13, 2018
Lloyd-Pottiger
added a commit
to Lloyd-Pottiger/poco
that referenced
this pull request
Sep 24, 2024
Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
JaySon-Huang
pushed a commit
to pingcap/poco
that referenced
this pull request
Sep 24, 2024
* Pick pocoproject#2145 Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com> * Pick pocoproject#2153 Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com> --------- Signed-off-by: Lloyd-Pottiger <yan1579196623@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pdjsonis strict about what it will accept;\\aand\\vare correctly rejected as escape sequences because the JSON standard doesn't support them.Poco::toJSONusesPoco::UTF8::escape, which utilises the supported C escape sequences of\a -> \\aand\v -> \\v, which makes complete sense for UTF-8 string escaping. However, it will then produce JSON which is non-conforming and will fail if parsed usingPoco::JSON::Parser.This change adds a
strictJSONoption toPoco::UTF8::escapewhich allows for strict JSON conformance when required (but off by default for compatibility with existing code). UpdatePoco::toJSONto use this new argument, and update/add tests where appropriate.