Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1200

ASCII file encoding with 16-bit bytes

$
0
0

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'?


Viewing all articles
Browse latest Browse all 1200

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>