length -package:bytestring package:utf8-string

Counts the number of characters encoded in the bytestring. Note that this includes replacement characters.
Counts the number of characters encoded in the bytestring. Note that this includes replacement characters.
Counts the number of characters encoded in the bytestring. Note that this includes replacement characters. The function is linear in the number of bytes in the representation.