According to the C standard, a byte can have more than 8 bits. How is an ASCII (or UTF-8) file encoded on systems with, e.g., 16-bit bytes since ASCII characters take up 8 (technically 7) bits? Does each character take up 16 bits, or are two characters concatenated into one byte?
For example, given the following code:
char character;FILE* file = fopen("file.txt", "r");fread(&character, 1, 1, file);
If the file is ASCII-encoded and contains the text ab
, does character
contain 'a'
or some concatenation of 'a'
and 'b'
?