Re: [csswg-drafts] [css-syntax-3] `non-ASCII ident code point` might be breaking because it excludes the use of emojis in idents (#8862)

Those are not codepoints that you're looking at.

```js
"💅".codePointAt(0).toString(16)
// '1f485'
```

The Syntax spec runs on a stream of code *points*, but JS naively returns code *units*, which are limited to the range 0-ffff. To encode any higher code points JS splits them into two code units using the reserved surrogate range, from d800-dfff. You have to account for this when parsing strings from JS. ([My parser](https://github.com/tabatkins/parse-css/blob/main/parse-css.js#L38) just eagerly converts the whole string into an array of codepoints, but these days you can do that more easily with an `Array.from(str, cp=>cp.codePointAt(0))` call, since the iterator protocol on strings advances by codepoint.)

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


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

Received on Monday, 22 May 2023 20:38:11 UTC