allow astral characters#190
Merged
puzrin merged 1 commit intonodeca:masterfrom May 13, 2015
Merged
Conversation
Collaborator
|
What's about performance of this? |
Member
|
That will be reworked. Wait. |
Member
Author
|
@dervus, less than ideal probably. I'll try to speed that regexp up. But it is meant to be a temporary solution, because checking non-printables before parsing doesn't really work well (see the point about JSON compatibility, I'll create a separate ticket for it though). |
Member
Author
Member
Author
|
Joined both regexps into one. If I didn't screw up, this could even be considered a performance improvement: |
Collaborator
|
OK, so is it ready to merge now? |
According to YAML 1.2 spec, #xD800-#xDFFF unicode range is considered non-printables. But unicode range #x10000-#x10FFFF, represented in UTF-16 by the same characters is not. NOTE: Non-printable characters are still allowed in quoted scalars, added a pending test for this case. Fixes: nodeca#191
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.
According to YAML 1.2 spec, section 5.1, unicode range #x10000-#x10FFFF is considered printable characters.
However, parser excludes those characters trying to validate for #xD800-#xDFFF. This is fixed in this PR, so well-formed surrogate pairs pass validation, but lone surrogates don't.
It is still not a standard-compliant solution, because YAML seems to allow non-printables in quoted scalars for JSON compatibility, so validating the entire source code against non-printable regexp doesn't work well enough. I added a pending test case for this, suggesting to open another issue ticket about it.