dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
480 stars 41 forks source link

Fix the issue where rg.el couldn't search Unicode character (Method 2 via pattern file) #168

Closed chansey97 closed 4 months ago

chansey97 commented 4 months ago

As the previous discussion, here is the alternative way to make rg.el support Unicode search on Windows.

Add the new switch rg-use-pattern-file.

When enabled, rg.el will use rg-pattern-file as pattern input, which corresponds to ripgrep -f input option. This is particularly useful on Windows, because NTEmacs subprocess creation doesn't support Unicode arguments.

Tested on Windows, but it should also work on Linux (although there is no benefit doing so).

P.s. This feature is disabled by default for keeping old behavior, and can be enabled it via set rg-use-pattern-file =t.

chansey97 commented 4 months ago

This method is not as good as the 1st one, because only "pattern" is written into file. If there are others Unicode strings (e.g. Chinese) embedded the argument list...

For example,

(setq rg-command-line-flags '("--ignore-file=C:/Users/Chansey/AppData/Roaming/.emacs.d/你好世界/test.txt"))

This will cause rg to be unable to find file:

C:/Users/Chansey/AppData/Roaming/.emacs.d/浣犲ソ涓栫晫/test.txt: The system cannot find the path specified. (os error 3)

but no problem with the 1st method.

Close due to this drawback.