[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep locale off by one?
From: |
Geoff Keating |
Subject: |
Re: grep locale off by one? |
Date: |
21 Aug 2003 23:28:57 -0700 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
address@hidden writes:
> address@hidden wrote:
> > What in the name of holy collating orders
> > is going on below?
> > $ echo "Z" | grep "[a-z]"
> > $ echo "Y" | grep "[a-z]"
> > Y
> > $ echo "a" | grep "[A-Z]"
> > $ echo "b" | grep "[A-Z]"
> > b
> > I know LC_ALL=C "fixes it", and I understand the collating
> > order being case insensitive, but why the inconsistency,
> > on the first and last characters (a and Z
> > in this case). Is it an off by one? Version info follows.
> > $ rpm -q grep glibc pcre
> > grep-2.5.1-7
> > glibc-2.3.2-11.9
> > pcre-3.9-10
> > $ echo $LANG
> > en_IE.UTF-8
>
> Looks like it's UTF-8 specific.
> Removing this makes it behave consistently.
>
> $ echo "Y" | LANG=en_IE.UTF-8 grep "[a-z]"
> Y
> $ echo "Z" | LANG=en_IE.UTF-8 grep "[a-z]"
> $ echo "Y" | LANG=en_IE grep "[a-z]"
> $ echo "Z" | LANG=en_IE grep "[a-z]"
>
> Pádraig.
It looks like in this locale, the order is a A b B c C ... z Z.
--
- Geoffrey Keating <address@hidden>