Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCharacter between U+0001 ~ U+001F in string should be escaped when serialized #15947
Comments
|
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the If you intend to work on this issue, then add |
|
I would like to work on this issue. |
|
Hey @ak1t0! Thanks for your interest in working on this issue. It's now assigned to you! |
|
Note that spec also says NULL character should be serialized to U+FFFD escaped as code point. But that doesn't match what Gecko and Blink do. Both browsers serialize NULL to U+FFFD itself, and we probably should do so here as well. I've raised an issue to CSSWG in w3c/csswg-drafts#1105. |
|
FWIW the spec text has been fixed in the expected way. |
Character between U+0001 ~ U+001F in string should be escaped when serialized Fixes [servo/servo#15947](servo/servo#15947) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/129) <!-- Reviewable:end -->
See the algorithm of https://drafts.csswg.org/cssom/#serialize-a-string
A simple test code:
In this case, the serialized output should be
url("\f good")rather than a string with unprintable char.This is actually an issue in rust-cssparser. The corresponding code is https://github.com/servo/rust-cssparser/blob/0caaba170616cba326c4311967354110e4c79c8f/src/serializer.rs#L249-L267
This should be an easy one to fix. cc @SimonSapin