Indeed. I wonder why they had to cook up something this totally and fundamentally useless. Most importantly, why is the locale global state? That alone will create all the same problems that have been plaguing OpenGL to the point that it got superseded.Chris wrote: TL;DR locales in C/C++ suck. Probably better to find a string or character handling library that better understands and works with Unicode/UTF-8/16/32.
Ability to customize the display of notifications (& more)
Moderator: GZDoom Developers
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Ability to customize the display of notifications (& mor
Re: Ability to customize the display of notifications (& mor
Some of that can be explained by ancient 1980's origins of the C runtime that C++ was based on. The odd thing is that they can't even decide to make unicode part of the standard, because even today you can't actually specify a locale without it being implementation specific.
I completely agree with Chris that the solution is to simply avoid using it at all. For me, std::string is a basic container (that I always put utf-8 into, regardless of the locale) and the only other text related stuff I might use from the standard library only comes into play if its basically locale agnostic (like std::to_string(int)).
I completely agree with Chris that the solution is to simply avoid using it at all. For me, std::string is a basic container (that I always put utf-8 into, regardless of the locale) and the only other text related stuff I might use from the standard library only comes into play if its basically locale agnostic (like std::to_string(int)).
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Ability to customize the display of notifications (& mor
Considering that even the entire printf family is locale dependent, there's not much that can really be used here. I already had my fun with code breaking because the locale was set to the local country for 'proper' formatting of numbers, but totally overlooked that this renders internal text processing with floats inoperable.
These standards committees are an odd bunch. They seem so fixated at compatibility with theoretical systems that they totally lose focus of practical concerns.
This here's a good point. Apparently they want to keep things compatible with other theoretical encodings by not making an Unicode dependency. Why even use wide chars if not?
These standards committees are an odd bunch. They seem so fixated at compatibility with theoretical systems that they totally lose focus of practical concerns.
This here's a good point. Apparently they want to keep things compatible with other theoretical encodings by not making an Unicode dependency. Why even use wide chars if not?
Re: Ability to customize the display of notifications (& mor
Here is how custom iswalpha() can be implemented. Alternatively, it's possible to code it as a huge number of if's, with or without table creation at runtime.