Re: [csswg-drafts] [css‑syntax] `<string‑token>` should probably handle valid surrogate pairs (#6352)

Well, back when **WebKit** didn’t correctly support the **CSS2.1** syntax (before [r114876](https://commits.webkit.org/r114876)), they implemented support for surrogate pairs<sup>[mailing list](https://lists.w3.org/Archives/Public/www-style/2012Jan/0536.html)</sup> as a workaround.

---

> I'm not sure what the significance of your comment about CSS1 only allowing 4-digit escapes is, sorry.

The **CSS1** syntax for Unicode escapes<sup>[CSS1 Appendix B](https://www.w3.org/TR/CSS1/#appendix-b)</sup> in case‑insensitive flex<sup>[CSS1 ref16](https://www.w3.org/TR/CSS1/#ref16)</sup> notation is:
```flex
unicode  \\[0-9a-f]{1,4}
```

Which means that anything after the 4th hex digit is not part of the escaped code point in **CSS1**:
```css
.foo:before {
 /*
 The "CSS1" specification parses this as:
  - U+0000 (Null)
  - U+0034 (Digit Four)
  - U+0031 (Digit One)
 The "CSS2.1" and "CSS Syntax Level 3" specifications parse this as:
  - U+0041 (Latin Capital Letter A)
 */
 content: "\000041";
}
```

-- 
GitHub Notification of comment by ExE-Boss
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6352#issuecomment-979087585 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 25 November 2021 10:50:31 UTC