Also unfortunately the web browser. Javascript strings are UTF-16 (Well, UCS2).
Really? I'd love to see some references to that.
I know there's some operations to convert a javascript string to UTF8, but everything which measures a string counts using 2-byte UCS2 items. For example, array-style indexing, string.length, str.charCodeAt(), split(), slice(), indexOf(), etc.
Also lots of DOM APIs use those weird string lengths too. For example, input element selectionStart / selectionEnd fields measure the selection range by counting surrogate pairs, not characters.
I remember that SpiderMonkey shifted to multiple encodings around 2019 and v8 had done that earlier.
Source: I was part of the SpiderMonkey team when the shift happened.