From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10078 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Remko_Tron=C3=A7on?= Newsgroups: gmane.linux.lib.musl.general Subject: Re: How to set UTF-8 as default Date: Thu, 2 Jun 2016 17:40:54 +0200 Message-ID: References: <20160602150154.GJ10893@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114b38447d323a05344d6eb3 X-Trace: ger.gmane.org 1464882080 24324 80.91.229.3 (2 Jun 2016 15:41:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 15:41:20 +0000 (UTC) Cc: musl@lists.openwall.com To: Rich Felker Original-X-From: musl-return-10091-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jun 02 17:41:13 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1b8Uk8-0002i6-N1 for gllmg-musl@m.gmane.org; Thu, 02 Jun 2016 17:41:08 +0200 Original-Received: (qmail 3702 invoked by uid 550); 2 Jun 2016 15:41:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 3674 invoked from network); 2 Jun 2016 15:41:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=el-tramo.be; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=f1FjRKTeW4PZ5AzGTKMSqj+rfac+YkNlgJDYrPDEJRY=; b=hiPC8djl2dOKmKTbOslinQx/+OdhOjo/qz33SFTefTQrtMrt1htj3W1mqfQqpKH7GV Z8yh/foyaAYu7Z+2rQ4Q/5U9FV0pExTvwqJ71VuR+BBxus6lQjF2ZZqoLxmfR2F81s3L G8Vy2DKW6nMHMdvWg4or6wKa+VL6+DHBqBqLU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=f1FjRKTeW4PZ5AzGTKMSqj+rfac+YkNlgJDYrPDEJRY=; b=HruiWEgTbUanaSZkl0dSIANgj4j7M/GsX0L6tVRYS3zSOQyje2u30L4kByk0fOIusP COFn61rc1KBjMvH/Ob7lzysbTCSr4GrcOC5ifj98dB7ygW6iGBlkSK2SHVJ/zSspJ6y0 FlFXtNLtooGF4W9m2KWhSBdNaFb/MQrDBPTrOHC0fwIGmas4H6shx0AzfotGR0ElSuRA mUR5baONDfLnt8Zw9q+znDk2VdnbA+8vhYXRNIgKBMwFDYzDKuzgD+R9nw5DcUxCc+ts l+sDlx2WuqUSN6gYUM1NIQ2YDvJz8xVe4w5QELEWlFEuo8ZcMcIUrA1kLDxtYbvMHBBa hrXA== X-Gm-Message-State: ALyK8tKeYsb9/xJOK4wlHH87uWQkpG/5nkpkms/JlQoDf+HYzb8fPwf9oeRZ+wzGH3VH3TcKg8wY4d0YB0Mnqg== X-Received: by 10.28.30.16 with SMTP id e16mr9209833wme.20.1464882054367; Thu, 02 Jun 2016 08:40:54 -0700 (PDT) X-Originating-IP: [84.194.176.162] In-Reply-To: <20160602150154.GJ10893@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:10078 Archived-At: --001a114b38447d323a05344d6eb3 Content-Type: text/plain; charset=UTF-8 Hi Rich, Thanks for your explanation. Just call setlocale(LC_CTYPE, ""). This is the only way a correct > program should ever use setlocale. 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. NULL is not the same thing as "". Passing NULL as the second argument > to setlocale simply queries the current locale name. It does not setup > the locale. > Right, I was just pointing out that the locale I tried to set in env variables wasn't being reported as the current locale by setlocale(). thanks! Remko --001a114b38447d323a05344d6eb3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Rich,

Thanks for your explanation.=

Just call setlocale(LC= _CTYPE, ""). This is the only way a correct
program should ever use setlocale.

So, if I= understand correctly, any program that expects `nl_langinfo`
to = return the locale set through environment variables (or other=C2=A0
platform-specific ways) should call setlocale(LC_*, "") before= =C2=A0
querying the locale; libc/musl/... will not trigger this r= egistration itself.

NULL= is not the same thing as "". Passing NULL as the second argument=
to setlocale simply queries the current locale name. It does not setup
the locale.

Right, I was just pointing = out that the locale I tried to set in env variables wasn't
be= ing reported as the current locale by setlocale().

thanks!
Remko
--001a114b38447d323a05344d6eb3--