[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug of sort??
From: |
jiusheng chen |
Subject: |
Re: bug of sort?? |
Date: |
Sat, 20 Sep 2008 10:01:26 +0800 |
Hi Bob and James,
Thank you, guys.
Quite professional answer, very informative:)
On Sat, Sep 20, 2008 at 6:11 AM, Bob Proulx <address@hidden> wrote:
> James Youngman wrote:
> > It looks to me like you probably just have locate settings that you don't
> like:-
> >
> > ~$ sort -t " " -k 1 < Desktop/T
> > ...versus...
> > ~$ LC_ALL=C sort -t " " -k 1 < Desktop/T
>
> I have the following in my $HOME/.bashrc file.
>
> export LANG=en_US.UTF-8
> export LC_COLLATE=C
>
> The documentation says:
>
> Unless otherwise specified, all comparisons use the character
> collating sequence specified by the `LC_COLLATE' locale.(1)
> ...
> (1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to
> `en_US'), then `sort' may produce output that is sorted differently
> than you're accustomed to. In that case, set the `LC_ALL' environment
> variable to `C'. Note that setting only `LC_COLLATE' has two problems.
> First, it is ineffective if `LC_ALL' is also set. Second, it has
> undefined behavior if `LC_CTYPE' (or `LANG', if `LC_CTYPE' is unset) is
> set to an incompatible value. For example, you get undefined behavior
> if `LC_CTYPE' is `ja_JP.PCK' but `LC_COLLATE' is `en_US.UTF-8'.
>
> Bob
>
--
Thanks,
Chen Jiusheng