On 10/22/2010 11:47 AM, Thorsten Glaser wrote:
Eric Blake dixit:
Yikes! setlocale() is busted when handed an unrecognized locale, in that it
falls back to a completely different locale rather than failing!
MirBSD has exactly one “locale”. And from what I gathered, back then,
other implementations also fall back, although, admittedly, to the "C"
locale.
But that's broken. Per POSIX:
http://www.opengroup.org/onlinepubs/9699919799/functions/setlocale.html
"If the string does not correspond to a valid locale, setlocale() shall
return a null pointer and the international environment is not changed.
Otherwise, setlocale() shall return the name of the locale just set."
Returning a completely different string (en_US.UTF-8), and in particular
falling back on a locale that is not the C locale, is just crazy.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org