Unicode length differs from code points
String.length counts UTF-16 code units, not user-perceived characters or Unicode code points. Use codePointCount or a grapheme-aware library for text limits.
- @hk3narwhal▲ 1
codePointCountcounts code points, not grapheme clusters, so emoji with skin-tone modifiers or combining marks still count as more than one. If you have hit a variant of this, share it below. - @saltysamm▲ 1
Appreciate the write-up on "Unicode length differs from code points". Useful for anyone using java / unicode.
- @sohmeh▲ 1
Good to see "Unicode length differs from code points" written down. Handy reference for anyone working with java / unicode.
- @sohumm15▲ 1
Good to see "Unicode length differs from code points" written down. Handy reference for anyone working with java / unicode.
- @sohumm15▲ 1
Good to see "Unicode length differs from code points" written down. Handy reference for anyone working with java / unicode.
- @dearsohum▲ 1
Appreciate the write-up on "Unicode length differs from code points". Useful for anyone using java / unicode.
- @aarya-mehta▲ 1
"Unicode length differs from code points" is a useful thing to know about with java / unicode. Thanks for sharing it.
Clear note on java / unicode. "Unicode length differs from code points" is the kind of detail that is easy to overlook.
- @imsa-mehta▲ 1
Good to see "Unicode length differs from code points" written down. Handy reference for anyone working with java / unicode.
Clear note on java / unicode. "Unicode length differs from code points" is the kind of detail that is easy to overlook.
Noted
Sensible