This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug: grep behaves incorrectly under the locale C.UTF-8, if a file contains Umlaut characters


> > If I grep the file using, say,
> 
> >      $ grep  .  X  >Y
> 
> > (i.e. select every non-empty line and write the result to Y), this works
> > fine, if LANG is set to one of: UTF-8, C, C.de_DE, C.en_EN, en_EN,
> > de_DE.
> 
> > However, if LANG is set to C.UTF-8, two things happen:
> 
> > - grep classifies the file as binary file and produces the error message
> > "Binary file X matches" 
> 
> This is an intended behavior, upstream decision since mid-2015, I recall.


Might be, but this still does not explain the issues 1., 2. and 3.,
which I layed out in detail below. Note that never said that the fact,
that grep classifies certain characters as binary, would by itself a
bug.

Or is the intended behaviour, that with C.UTF-8 (and *only* with this
setting), the resulting standard output of grep is interspersed with
"Binary file matches" lines? If this is the case, I really would like to
se a justification for this decision. 


> 
> > - Both the grepped lines (i.e. in our example the non-empty lines) AND
> > the error message end up in the standard output (i.e. in file Y).
> 
> > IMO, there are several problems with this:
> 
> > 1. It's hard to see, why an umlaut character makes the file X binary
> > under encoding C.UTF-8, but not under encoding UTF-8 or C.en_EN
> 
> > 2. If grep classifies a file as binary, I think the desired behaviour
> > would be to NOT produce any output, unless the -a flag has been
> > supplied.
> 
> > 3. If grep writes a message "Binary file ... matches", this message
> > should go to stderr, not stdout. The stdout is supposed to contain only
> > a subset of the input lines.
> >  Ronald

--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]