Date: Thu, 2 Jun 2016 13:32:58 -0400 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: How to set UTF-8 as default On Thu, Jun 02, 2016 at 07:10:01PM +0200, Markus Wichmann wrote: > On Thu, Jun 02, 2016 at 05:40:54PM +0200, Remko Tronçon wrote: > > So, if I understand correctly, any program that expects `nl_langinfo` > > to return the locale set through environment variables (or other > > platform-specific ways) should call setlocale(LC_*, "") before > > querying the locale; libc/musl/... will not trigger this registration > > itself. > > A libc that did that wouldn't be ISO-C compliant, because ISO-C says > that the initial locale has to be "C". Well per ISO C, it could define the C locale that way (like musl used to) but it's subject to some restrictions that musl did not follow, making it slightly non-conforming. POSIX however is going to require a byte-based C locale, and already has further requirements on character classes that made it hard to conform to without just adopting the future requirement. > I will often just call setlocale(LC_ALL, ""); at the start of the > program, as that saves me the headache of selecting all the correct > locale categories for my program. Yes, this is a good practice, although often you want to avoid setting LC_NUMERIC or explicitly set it back to "C" so that floating point number parsing/printing is not broken. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.