From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5612 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Locale bikeshed time Date: Sat, 26 Jul 2014 04:03:27 -0400 Message-ID: <20140726080327.GJ4038@brightrain.aerifal.cx> References: <20140723192503.GG16795@example.net> <20140723210120.GD11570@brightrain.aerifal.cx> <20140724153526.GH16795@example.net> <20140724160150.GA4038@brightrain.aerifal.cx> <20140724201548.GM16795@example.net> <20140724220228.GB4038@brightrain.aerifal.cx> <20140725090649.GN16795@example.net> <20140725201551.GQ16795@example.net> <20140725223239.GG4038@brightrain.aerifal.cx> <20140726072502.GR16795@example.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1406361882 9005 80.91.229.3 (26 Jul 2014 08:04:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Jul 2014 08:04:42 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-5617-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jul 26 10:04:36 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XAwy1-0000RF-Pp for gllmg-musl@plane.gmane.org; Sat, 26 Jul 2014 10:04:33 +0200 Original-Received: (qmail 11440 invoked by uid 550); 26 Jul 2014 08:04:32 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 10187 invoked from network); 26 Jul 2014 08:03:39 -0000 Content-Disposition: inline In-Reply-To: <20140726072502.GR16795@example.net> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:5612 Archived-At: On Sat, Jul 26, 2014 at 09:25:03AM +0200, u-igbb@aetey.se wrote: > > Changing the numeric radix point is explicitly not supported. :) > > LC_NUMERIC is just always C because, well, numbers are numbers, not > > something to vary by culture, and changing the radix point just breaks > > parsing and storing data for interchange. LC_MONETARY on the other > > I am fully with you on the point of formatting numerical data for > intechange. The purpose of locale is though the exact _opposite_, to > represent data in a format especially chosen for the specific occasion > and a specific user, _differently_ from what would be suitable for the > rest of the world. Isn't it? > > So I would say it is indeed stupid to localize data meant for > interchange. Nevertheless it may still be meaningful to format numbers > for the user's taste when the data presentation is only meant for some > kind of a "local" context. The problem is that the vast majority of actual printing and parsing of floating point numbers is for interchange purposes, not mere visual pretty-printing, and the existence of alternate radix characters introduces subtle bugs into programs that are not tested in such locales. Very few programs or libraries I've seen go to the trouble to obtain a usable LC_NUMERIC locale in a portable, thread-safe, and library-safe way before calling snprintf or strtod. And lots of broken gui libraries set LC_NUMERIC behind the application's back even if the application only wanted to set other categories. > Is there anything that postulates C locale to use "." as the radix point? Yes, it's required by ISO C and POSIX. The C locale is defined by its ability to be used for translating C programs. In C programs, the radix point is ".". > Is there any evidence that "." is more widely used than "," ? Well, 2/3 of the world's population is in India and China and they all use ".", so I think that pretty much covers the question of which is "more widely used". > Do not misunderstand my questions as a cultural bias. I am _much_ > more used to the decimal dot than comma, because of the involvement > with programming languages using ".". Nevertheless locale is not about > representing data for computers, but for humans - and I would love to > have a best possible internationally useful locale as the default. This goes back to the question about modern versus old tradition. Alternate radix points are a cultural convention that's (seemingly, hopefully) on the way out due to computers and information interchange. Maybe in some sense this is cultural imperialism (or just globalization or whatnot) but it's certainly a lot less negative than the "everyone should use English" attitude. Nobody's saying "don't use your language", just "don't gratuitously break things for a one-pixel difference". :-) Rich