如何让Emacs的Mx rgrep兼容UTF8和UTF16文件?

use*_*592 10 emacs utf-8 utf-16

是否可以自定义Emacs以便rgrep在UTF8(甚至拉丁文)和UTF16文件中正确查找某些模式的出现?

我想我们应该定制grep-find-template,但不能通过它.

编辑2017-06-16 我现在有一个为shell 工作utf-8/16 cat命令的例子.grep如果可能的话,它应该转换为Emacs的.这里是:

cat $1 | ( [[ $(file -i $1) =~ utf-16be ]] && ( iconv -f UTF-16 -t UTF-8 || true ) || cat )
Run Code Online (Sandbox Code Playgroud)