Returns the byte count of a string, accounting for multi-byte characters.
Uses a fast ASCII-only shortcut when the string contains no characters above U+007F; otherwise falls back to TextEncoder for an accurate count.
TextEncoder
The string to measure.
The number of bytes the string occupies when UTF-8 encoded.
Returns the byte count of a string, accounting for multi-byte characters.
Uses a fast ASCII-only shortcut when the string contains no characters above U+007F; otherwise falls back to
TextEncoderfor an accurate count.