diff --git a/grep.c b/grep.c index f7c3a5803e..b651506f83 100644 --- a/grep.c +++ b/grep.c @@ -421,7 +421,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt) static int pcre1match(struct grep_pat *p, const char *line, const char *eol, regmatch_t *match, int eflags) { - int ovector[30], ret, flags = 0; + int ovector[30], ret, flags = PCRE_NO_UTF8_CHECK; if (eflags & REG_NOTBOL) flags |= PCRE_NOTBOL; diff --git a/grep.h b/grep.h index 1875880f37..9c8797a017 100644 --- a/grep.h +++ b/grep.h @@ -3,6 +3,9 @@ #include "color.h" #ifdef USE_LIBPCRE1 #include +#ifndef PCRE_NO_UTF8_CHECK +#define PCRE_NO_UTF8_CHECK 0 +#endif #ifdef PCRE_CONFIG_JIT #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32 #ifndef NO_LIBPCRE1_JIT