mirror of
https://github.com/uutils/grep.git
synced 2026-06-10 16:15:11 -07:00
grep: keep invalid UTF-8 text under -I (#49)
This commit is contained in:
+3
-1
@@ -493,7 +493,9 @@ impl<'a> Searcher<'a> {
|
||||
|
||||
if let Some(positions) = self.session_match_line(line) {
|
||||
// TODO: GNU grep respects LANG. Here, I'm always checking for valid UTF-8.
|
||||
if !self.session_mark_binary_if(|| std::str::from_utf8(line).is_err()) {
|
||||
if self.config.binary_mode != BinaryMode::WithoutMatch
|
||||
&& !self.session_mark_binary_if(|| std::str::from_utf8(line).is_err())
|
||||
{
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user