Characters are not bytes
Byte size depends on encoding. UTF-8 uses variable-length sequences; UTF-16 uses two-byte code units and may require a pair for one symbol. Measurements exclude a BOM.
Example and limitations
A is one byte in UTF-8 and two in UTF-16; Arabic and emoji differ. Unicode code-point count is not always the number of visible composed characters.