Proposal: `String.prototype.codePointCount`

Tab Atkins Jr. jackalmage at
Thu Aug 8 14:25:02 UTC 2019

On Thu, Aug 8, 2019 at 2:45 AM Claude Pache <claude.pache at> wrote:
> In fact, for my purpose, I have no reason to impose a limit for a precise number of *code points* (as opposed to other possible definitions of “length” such as *UTF-16 code units* or *grapheme clusters*). Technically, I am usually limited by the size of a column in the database, for which the “size” corresponds typically to the number of bytes in a UTF-8 encoded string. From a user point-of-view, the number of “characters” is better approximated by the number of grapheme clusters. None of those two notions of “length” correspond to the number of code points.

Yup, code points, while a useful specification concept to work with,
are in fact very rarely what you actually need to care about for
anything in real use-cases! Bytes or grapheme clusters are almost
always what you want.


More information about the es-discuss mailing list