From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: How to set UTF-8 as default
Date: Thu, 2 Jun 2016 13:32:58 -0400 [thread overview]
Message-ID: <20160602173258.GL10893@brightrain.aerifal.cx> (raw)
In-Reply-To: <20160602171001.GA10492@voyager>
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
prev parent reply other threads:[~2016-06-02 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 11:05 Remko Tronçon
2016-06-02 14:50 ` FRIGN
2016-06-02 15:03 ` Rich Felker
2016-06-02 15:01 ` Rich Felker
2016-06-02 15:40 ` Remko Tronçon
2016-06-02 17:10 ` Markus Wichmann
2016-06-02 17:32 ` Rich Felker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160602173258.GL10893@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).