Subject: Re: bug#17188: Sort bugs

From: Eric Blake <[email-masked]>
Date: Mon, 07 Apr 2014 06:46:37 -0600

On 04/05/2014 02:44 PM, Nikos Balkanas wrote:

> What about sorting input based on the input's locale, instead of the
> system's?

And how do you propose to detect the input's locale?  The canonical way
to tell a program what locale the input is in is by setting the
environment variable LC_COLLATE and/or LC_ALL.

> Sort
> can distinguish ASCII (iso) from UTF-8 and collate accordingly.

ASCII is a subset of UTF-8.  There is no way to tell if input was
intended as one or the other without setting an environment variable to
make your intentions clear - but this is precisely what you already do
to get sort to do what you want.  And since this behavior is mandated by
POSIX (the behavior of LC_ALL and friend controlling how 'sort' and all
other utilities will collate, based on the definition of the chosen
locale), it is better to point people to a consistent standard that will
work across ALL implementations of 'sort', than it is to invent yet
another non-standard knob for just GNU sort.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org