Re:A Tale of Two Libcs
by iforgotpassword on Saturday September 26, 2020 @06:59AM
(#24597851)
:-) I'm a C dev. Systems mostly but I still hate locales.
As much as this person? https://github.com/mpv-player/mpv/commit/1e70e82baa9193f6f02...
It doesn't.
> This is bullshit.
Welcome to POSIX locales.
> Great, now isalnum returns true for ä if I'm using de_DE.latin1 or whatever, but is still nonsense for any non-western language.
Technically it's already nonsense for western languages as ISO-8859 is long outdated, and any codepage other than ISO-8859-1 will not fit inside a uchar when decoded from UTF-8. Also there were non-western languages which fit in 8-bit encodings for which isalnum would work fine.
> And the price we pay for that is a messed up pile of garbage that nobody understands and can segfault.
Welcome to POSIX locales. And also C, where not reading and understanding the implication of every word in the specification means you're bad and therefore deserve everything you get. In this case, POSIX clearly specifies that input values outside of EOF or "unsigned char" is UB.