MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wxqahk/architecturedependentchars/pdz2l82/
r/ProgrammerHumor • u/MontyBoomslang • Oct 04 '26
372 comments sorted by
View all comments
Show parent comment
1
In C, a char is just one byte; it did correspond to a character while ASCII was being used, but, nowadays, character encodings are multi-byte.
char
A Unicode grapheme cluster (what you'd intuitively think of as a "character") can be composed of multiple UTF-8 bytes.
1 u/FuckIPLaw Oct 05 '26 Besides: in C you're often still dealing with actual ascii because one of the main uses for C in 2026 is embedded stuff. 1 u/thanatica Oct 06 '26 Then how do you, say, split a string? You do know utf-8 is a variable width encoding, so... Difficult at best? 1 u/gmes78 Oct 06 '26 You use a library to do it. ICU is the reference implementation, but there are other alternatives, such as utf8proc.
Besides: in C you're often still dealing with actual ascii because one of the main uses for C in 2026 is embedded stuff.
Then how do you, say, split a string? You do know utf-8 is a variable width encoding, so... Difficult at best?
1 u/gmes78 Oct 06 '26 You use a library to do it. ICU is the reference implementation, but there are other alternatives, such as utf8proc.
You use a library to do it. ICU is the reference implementation, but there are other alternatives, such as utf8proc.
View all comments
Show parent comment
1
u/gmes78 Oct 05 '26
In C, a
charis just one byte; it did correspond to a character while ASCII was being used, but, nowadays, character encodings are multi-byte.A Unicode grapheme cluster (what you'd intuitively think of as a "character") can be composed of multiple UTF-8 bytes.