JavaScript Unicode normalization

前端 未结 4 2045
执念已碎
执念已碎 2020-12-16 14:33

I\'m under the impression that JavaScript interpreter assumes that the source code it is interpreting has already been normalized. What, exactly does the normalizing? It can

4条回答
  •  离开以前
    2020-12-16 14:46

    ECMAScript 6 introduces String.prototype.normalize() which takes care of Unicode normalization for you.

    unorm is a JavaScript polyfill for this method, so that you can already use String.prototype.normalize() today even though not a single engine supports it natively at the moment.

    For more information on how and when to use Unicode normalization in JavaScript, see JavaScript has a Unicode problem – Accounting for lookalikes.

提交回复
热议问题