|
From: | Dmitry Gutov |
Subject: | Re: dired-do-find-regexp failure with latin-1 encoding |
Date: | Sat, 28 Nov 2020 22:16:21 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 28.11.2020 21:13, Eli Zaretskii wrote:
From: Stephen Berman <stephen.berman@gmx.net> Cc: emacs-devel@gnu.org Date: Sat, 28 Nov 2020 19:46:18 +0100Does it work for ä if you say C-x RET c latin-1 RET A ä RET ?Yes (with -a added to the grep invocation, but not without it). And then with either 'a' or 'ä' as the search term, *xref* displays 'aä'. So this seems to be the best workaround, though inconvenient for frequent usesI really don't see any other way, especially if different files in the directory have different encodings. Grep looks for bytes, not characters, and is agnostic to encoding. And even if we'd do this in Emacs Lisp, we'd still need to trust Emacs to guess/detect the correct encoding of each file.
Ah, so this way the user explicitly searches for a regexp encoded as latin-1?
Do you then agree to adding -a to the grep invocation in xref-matches-in-files? Or could that have undesirable consequences?Adding -a probably cannot do any harm, but its support should be detected, since I don't think it's portable enough (it isn't in the latest Posix spec, at least).
Are you sure about that? Are we sure it won't make searching binary files slower, for example?
Also, the manual has this warning:Warning: The -a option might output binary garbage, which can have nasty side effects if the output is a terminal and if the terminal driver interprets some of it as commands.
...which might conceivably mess up our parsing of Grep output sometimes?P.S. Or we can forgo all that and ask the users who want to search for non-ASCII strings to install ripgrep. I've posted a patch which adds its support a couple of months ago, and I fully intend to resurrect it (mostly for performance reasons, though).
[Prev in Thread] | Current Thread | [Next in Thread] |