Hacker News new | ask | show | jobs
by hoppipolla 5240 days ago
The DOM and ECMAScript both assume that strings are sequences of UTF-16 codepoints. So while a browser could use non-UTF-16 internally it wouldn't help much because you would have to convert to UTF-16 in all the externally-facing APIs anyway.
2 comments

Nearly 100% true, but not quite: http://mathiasbynens.be/notes/javascript-encoding
'𝌆'.length == 2

ಠ_ಠ They did the same kludge as the old narrow builds of Python.

JS engines use various strategies depending on actual string content because it's more memory- and cache-friendly.