Subject: bug#18266: Bug#758105: bug#18266: grep -P and invalid exits with error

From: Paul Eggert <[email-masked]>
Date: Thu, 14 Aug 2014 11:19:28 -0700

Vincent Lefevre wrote:

> it would be better to replace invalid UTF-8 sequences by
> zero bytes before passing them to libpcre. Is it allowed to do
> that in Pexecute()?

Sorry, I don't know.  I was hoping that the volunteer (whoever it is) 
could figure all this stuff out.

grep should work correctly even if the input contains NUL bytes, so 
perhaps it would be better to replace an invalid byte by the UTF-8 
sequence for U+FFFD REPLACEMENT CHARACTER, as that's one standard way to 
deal with this problem.  Or perhaps the volunteer will have a better idea.