3 ms·
I agree that it is terrible that this is undefined, but utf-8 is not a Locale. That is an encoding. The standard works just fine when you use C as the Locale an
by dwheeler 8y ago
I agree that it is terrible that this is undefined, but utf-8 is not a Locale. That is an encoding. The standard works just fine when you use C as the Locale and utf-8 as the encoding. I think they should have just defined ranges as being the encoding values, because that would make more sense, but that would be exactly the opposite of what the standard previously said.
- 1996 8y agoFunny enough, after plenty of locale nonsense with ls and the other tools, I decided my locale was C.UTF-8 This works at least as well as en-US, and provides me just enough internationalization to remove the most annoying americanocentric things
- kijin 8y ago> utf-8 is not a Locale. Of course it isn't. What I suggested above is to use neither locales nor UTF-8, but code points. "a" = U+0061 no matter which locale you're in, and no matter which encoding you use. Every locale and every encoding is based on the same universal mapping of characters to code points.
- oldmanhorton 8y agoSure, but those code points are arbitrary. For instance in German languages, you may want a-z to include umlauted vowels, or you may not. That's a locale specific setting, even though the umlauted characters come well outside of the range of ascii a to z.
- mmt 8y agoKeeping ranges undefined doesn't satisfy these wants, either. Using code points would at least allow for ranges to have the possibility of being usable to someone in a standard, predictable fashion, outside of the C/POSIX locale. For example, specifying a-z plus each umlauted vowel is still shorter than specifying all letters individually. Perhaps there is some wisdom in William S. Burrough's "If you can't be just, be arbitrary."
- dwheeler 8y ago> What I suggested above is to use neither locales nor UTF-8, but code points. I agree, I think that is the right thing to do for ranges. If you want "all alphas in the current locale", then you should use some special indicator like [:alpha:] that is defined to be that.