def countable_length(str) str.mb_chars.grapheme_length end grapheme_lengthを使っている grapheme_length Returns the number of grapheme clusters in the string. https://api.rubyonrails.org/v6.0.2.2/classes/ActiveSupport/Multibyte/Chars.html#method-i-grapheme_length というわけで書記素クラスタを考慮した感じでやっているらしい Web側 stringz というライブラリを使っている stringz Javascript has a serious problem with unicode. Even ES6 can’t solve the probl
![Mastodonの文字数測定は何を使っているか](https://cdn-ak-scissors.b.st-hatena.com/image/square/6ac86816b8690f601587911f97a59c0eca1727bb/height=288;version=1;width=512/https%3A%2F%2Fstorage.googleapis.com%2Fzenn-user-upload%2Favatar%2F94b7bc06a8.jpeg)