|
From: | Eric Blake |
Subject: | Re: MirBSD mbtowc bug? failure on test-wcrtomb |
Date: | Fri, 22 Oct 2010 12:05:31 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4 |
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 address@hidden +1-801-349-2682 Libvirt virtualization library http://libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |