Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 26 Jul 2014 04:03:27 -0400
From: Rich Felker <>
Subject: Re: Locale bikeshed time

On Sat, Jul 26, 2014 at 09:25:03AM +0200, 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". :-)


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.