On 10/24/2010 02:20 AM, Thorsten Glaser wrote:
a minimally POSIX compliant setlocale() function ought to return NULL when
asked to set such a locale.
But the system doesn’t even know about charsets.
But it can be as simple as
set = strchr (locale, ".");
if (!set
|| !strcmp (set, ".UTF-8") || !strcmp (set, ".utf-8")
|| !strcmp (set, ".UTF8") || !strcmp (set, ".utf8")
|| !strcmp (set, ".OPTU-8") || !strcmp (set, ".optu-8")
|| !strcmp (set, ".OPTU8") || !strcmp (set, ".optu8"))
return locale;
return NULL;
Paolo