[BUG REPORT]sed -e 's/[B-D]/_/g' replaces unexpected characters

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Jun 25 15:38:00 GMT 2013

On Jun 25 22:37, Atry wrote:
> [...]
> $ echo abcdeABCDE | sed -e 's/[B-D]/_/g'
> ab__eA___E

Your locale is zh_CN.UTF-8.  What you're expecting is only guaranteed in
the C locale:

  $ LANG=C && echo abcdeABCDE | sed -e 's/[B-D]/_/g'

The character ordering is based on the default Windows ordering for the
locale, and that's dictionary ordering, apparently.

This is unfortunately different from the default ordering under Linux,
but off the top of my head I don't see how to change that.

I'll have a look, though, but no guarantees.  It's been a long time
since working on Cygwin's NLS functions...


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

More information about the Cygwin mailing list