Re: [w3c/uievents] Clarify `keypress` event handling for keys that map to non-BMP Unicode symbols (Issue #346)

I believe Masayuki's point is that `String.fromCharCode()` takes a sequence of UTF-16 code-units, not UCS4 code-units (i.e. code-points).  Changing the legacy `charCode` to return Unicode code-points rather than UTF-16 code-units would mean "char code" being used inconsistently across different contexts.

With `input` events there is only the `data` field, conveying the input text as a text string, though with the fun caveat that (at present) it seems that some platforms (e.g. Windows) supply UTF-16 surrogate code-units in independent events, which is a little painful.

To reiterate my earlier point: Defining the desired behaviour for the modern input events (e.g. `input`, `keydown`) in the presence of multi code-unit input (e.g. UTF-16 surrogate pairs) seems the first place to focus.  For the legacy events the right normative specification may need to differ (e.g. continuing to have `keypress` delivered once per UTF-16 code-unit, for example), reflecting how things have historically worked, rather than how we'd ideally expect/want them to. :)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/346#issuecomment-1570250807
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/uievents/issues/346/1570250807@github.com>

Received on Wednesday, 31 May 2023 13:35:52 UTC