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

Fix parsing of unicode escape sequences in YAML #3604

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

knutwannheden
Copy link
Contributor

A YAML scalar value can contain unicode escape sequences like \u0051. Currently, this throws off the parser.

A YAML scalar value can contain unicode escape sequences like `\u0051`. Currently, this throws off the parser.
@@ -400,34 +400,30 @@ void mappingAnchor() {
" '\\n' ",
" '\n' ",
" \n ",
" \"\\.\" ",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I've removed the escape sequences which are illegal according to the SnakeYAML parser.

@knutwannheden
Copy link
Contributor Author

@nmck257 In #2264 you added logic to handle escape sequences. Unfortunately the tests inadvertently got disabled when we switched from Kotlin to Java. In this PR I have re-enabled the tests again, but I had to remove some of the cases, since the escape sequences appear to be invalid (at least according to the SnakeYAML parser).

I was wondering if you could have a look at this PR and make sure that the implementation still meets your requirements.

@nmck257
Copy link
Collaborator

nmck257 commented Oct 5, 2023

@knutwannheden yep, no concerns. I'll gladly trust the SnakeYaml parser; maybe some patch version over the past ~year helped it catch invalid edge cases which it did not notice before.

@knutwannheden
Copy link
Contributor Author

Thanks a lot for taking a look!

@knutwannheden knutwannheden merged commit 02df387 into main Oct 5, 2023
1 check passed
@knutwannheden knutwannheden deleted the yaml-unicode-escapes branch October 5, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants