@zundanzunda Ruby 3.1以前だと"吉村家".encode("UTF-16").sizeも4になるので𠮷を2と数えているのではなくてBOMも数えているのかもしれません。コードユニット数を数えるのは.encode("UTF-16LE").bytesize / 2でよさそうな気がします

0

If you have a fediverse account, you can quote this note from your own instance. Search https://ruby.social/users/shugo/statuses/114175877380694754 on your instance and quote it. (Note that quoting is not supported in Mastodon.)