Page 3 of 3

Re: Ability to customize the display of notifications (& mor

PostPosted: Fri Aug 23, 2019 3:31 pm
by Graf Zahl
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.


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.

Re: Ability to customize the display of notifications (& mor

PostPosted: Sat Aug 24, 2019 1:18 am
by dpJudas
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)).

Re: Ability to customize the display of notifications (& mor

PostPosted: Sat Aug 24, 2019 2:08 am
by Graf Zahl
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?

Re: Ability to customize the display of notifications (& mor

PostPosted: Sat Aug 24, 2019 4:21 am
by _mental_
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.