This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: [BUG REPORT]sed -e 's/[B-D]/_/g' replaces unexpected characters
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 25 Jun 2013 18:09:11 +0200
- Subject: Re: [BUG REPORT]sed -e 's/[B-D]/_/g' replaces unexpected characters
- References: <CA+nJC97He=j-O2FZ-Y2jJhYXEJn2o2EfC1wO39+2bZ=nj1f-zA at mail dot gmail dot com> <20130625152356 dot GD11958 at calimero dot vinschen dot de> <5F8AAC04F9616747BC4CC0E803D5907D0C37C240 at MLBXv04 dot nih dot gov> <20130625160359 dot GB14459 at calimero dot vinschen dot de>
- Reply-to: cygwin at cygwin dot com
On Jun 25 18:03, Corinna Vinschen wrote:
> On Jun 25 15:38, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
> > > Your locale is zh_CN.UTF-8. What you're expecting is only guaranteed
> > > in the C locale:
> >
> > I'm not quite sure it applies here. I'm using US English Windows 7.
> >
> > LANG = 'en_US.UTF-8'
> >
> > I get the same result:
> >
> > $ echo abcdeABCDE | sed -e 's/[B-D]/_/g'
> > ab__eA___E
> >
> > BUT:
> >
> > $ echo abcdeABCDE | LANG=C sed 's/[B-D]/_/g'
> > abcdeA___E
> >
> > This is very weird, indeed.
> >
> > OTOH, in Linux I have the same LANG setup, yet it does work
> > correctly:
> >
> > > echo $LANG
> > en_US.UTF-8
> > > echo abcdeABCDE | sed -e 's/[B-D]/_/g'
> > abcdeA___E
> >
> > I believe that an en_US UTF-8 string representation for
> > "abcdeABCDE" is not any different from ASCII.
>
> Wrong. Try this:
>
> $ sort
> a
> b
> c
> d
> e
> A
> B
> C
> D
> E
> <Ctrl-D>
> a
> A
> b
> B
> c
> C
> d
> D
Which also means, AFAICS, Cygwin's sed is doing it right, Linux' sed
is doing it wrong. Yes, that puzzles me a bit at the moment, too.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple