When I have non-ASCII characters in my C code, TIO counts them as 1 byte.
For example, the following C program prints 56 music-related characters on the terminal.
TIO reports its length as "96 chars, 96 bytes (SBCS)". I understand "SBCS" as follows:
C never standardized its source code format. I assume this source code uses an unspecified single-byte codepage. So each character counts as a single byte.
However, this is unrealistic — even if I include more than 256 different characters in my source code, it still assumes that each character corresponds to one byte.
For reference, here is corresponding code in Python: link
So when can we use byte count reported by TIO as code score?
- Always?
- Only when our source code contains fewer than 256 different characters?
- Maybe ASCII + 128 other characters?
- Only when some "official" single-byte codepage can represent our source code?
Someone has recently mentioned that "We've been through this many times", but I couldn't find any discussion on it.
-l
option to report the correct number of bytes, although that's buggy on TIO. \$\endgroup\$