Congratulations, you've discovered why UTF-16 is stupid. You pay the space penalty of two-byte characters and the complexity penalty of variable-length characters.
It's the worst of both worlds!
Seriously nobody advocates UTF-16. The smart people advocate UCS-2.
Ok. lol. THAT's the dumbest thing I've read on HN.
You can either have Javascript uses UTF16 because UCS2 is dead. Or you can have variable width is stupid. JavaScript supports UTF16 (otherwise; no emoji). UCS2 is also a Unicode standard - just an old one, in their own words:
> In particular, for the purposes of data exchange, UCS-2 and UTF-16 are identical formats.
https://web.archive.org/web/20030818043641/http://www.unicod...