Subject: Re: bug#19985: active locale impacts binary data detection?

From: Paul Eggert <[email-masked]>
Date: Mon, 02 Mar 2015 18:31:27 -0800

The new behavior is expected, and this is mentioned in the NEWS file:

   If a file contains data improperly encoded for the current locale,
   and this is discovered before any of the file's contents are output,
   grep now treats the file as binary.

In some cases one can get the old behavior with 'grep -a'.

This is not the first time the problem has been reported.  Please see:

http://bugs.gnu.org/19230

If the problem occurs often enough, perhaps we should change grep's behavior. 
For example, perhaps grep should fall back on the C locale if the first part of 
a file contains an encoding error but no NUL bytes.