From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: dired-do-find-regexp failure with latin-1 encoding Date: Sat, 28 Nov 2020 19:03:17 +0100 Message-ID: <87blfhjr4q.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1231"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 28 19:04:15 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kj4Zz-0000CY-GX for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Nov 2020 19:04:15 +0100 Original-Received: from localhost ([::1]:47430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kj4Zy-0002L9-In for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Nov 2020 13:04:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kj4ZE-0001wI-Jq for emacs-devel@gnu.org; Sat, 28 Nov 2020 13:03:30 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:47381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kj4ZB-0000ao-LV for emacs-devel@gnu.org; Sat, 28 Nov 2020 13:03:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606586601; bh=iY2zR2stk7CgWGoAllurqyKqCHlAKEPsmgsxv9eIrF8=; h=X-UI-Sender-Class:From:To:Subject:Date; b=TTv5ubrLEZuMQdAXMG5VJLfcfoLW/K/Q3M+nMCDpTf0p1b/YZW7gLokDi7CT7rBk8 IUo8K86YX2iNPrzciSig1vg0Sg3EZskmEvzVs/b6/CD7pvBgXvT7FrBKv00P9gmLDW vs9AcX1Jd99NfO8yp7j43l8s5apIlSjrjk3VvrKc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-jhalfs ([188.109.153.25]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MdvmY-1kAIFL2xZm-00b2FZ for ; Sat, 28 Nov 2020 19:03:21 +0100 X-Provags-ID: V03:K1:F67uBi3gLzLQpV68HB4ibgOAYWwvad0NR1+8pak1zmV3EEZ3A51 rE77Ud5lLoMqFJREvzW3ONSZmy/6IfiAtMorMrgQT8TW0feW14rYNuPhxhgkePXj86IjXKg OS3IdpCfx8EpOn6zMwPWLauLeRfAXzDsZUj5ju1gRy2NCiQwneka8974jDc3H95qalnMMiO Ap+GHD4wq4WegAD0GbAnA== X-UI-Out-Filterresults: notjunk:1;V03:K0:mh6xSRlVNNk=:RF9+OCr8cfNFIfY6cNV4qw Pe1HWJ43QzZH2larTTRvxUCJg2fk/nFbf+8ez6q6zFkFg5GU50velBAsEmC4sxq00OHccreV3 P+KPCm68UCOudRHGtaDgnTl15RUzoAPJf4hwt0WZ/kIzoLZnbe/qEgsCvxQ3511SQ200il8Yp O1TE50pdXuM6xx4ekT8MJB5jHy8cGnJk9ckBISFsmPPD0dW6brfazbWcL9cPA4K2Od2r1vFNP n+JubgIC5zao1FVMaaZ1fAlkMHCCHHM/Y4pEXMI1FbcgQwd/0hPgDMCkv8Pyu/Lj9tz2a159j RwesmTy5q8sUEkttYV3FvTl7CF0s++u40kn7OI1Nq0BkvVPBhGm5wcbMbweF8QTLxkJNQMbyf Uv/L/djZ2iLKB4J05kRSsQAh93se1hY5GOVsSO8rgeqF8aQ7h4+o8WaaEKvEmZWDMADBnr5Q6 Q7QxeAhcsMnQAIgKfCFLr/psIknJl+QXZf3ws6KOWJ9Z3/m/cUYDy6B4sSG5RA78PWTLDS7vS vDD0nEgnE7PhOFGSNGE4669kc8CaoTmVksbv0324FFrTwNj46IKFlIl2skz8GxK++2tkNkCEm G7EKsSrcLANT6Y7h1keW37WcrgBJioA3D5llUnVYZYdxdOOLc2kEOgXt622poY4JoD1ufbBKK 5Vgk/biGc9Hd/yyfsyHphPGsx5++1t508txXLC7I72ZoPvT4evjJNlM9J49e2cbB6xuH9xj74 0e+RT/5nO6bMjgdOjFVyurCaoEzAa44z86OKNQu9y8Ob0XpDsA06T/3sHODSVOzwX9eXFTM6 Received-SPF: pass client-ip=212.227.17.22; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:259963 Archived-At: My system's language encoding is en_US.UTF-8 but I have many files encoded as iso-8859-1 (latin-1) and containing a mix of ASCII and non-ASCII characters. When I use dired-do-find-regexp on such files, there are no matches in the *xref* buffer for lines containing both the search string and a non-ASCII character. If the file is encoded as utf-8, then dired-do-find-regexp does find such lines. Here's a minimal reproducer: 0. echo a=C3=A4 > /tmp/test 1. emacs -Q /tmp/test ; the file encoding is utf-8 2. Type `C-x d RET', mark the file 'test', type `A a RET' =3D> *xref* displays the line 'a=C3=A4' 3. In buffer 'test' type `C-x RET f iso-8859-1 RET' and then `C-x C-s' 4. Repeat step 2 =3D> user-error: No matches for: a dired-do-find-regexp calls xref-matches-in-files and that calls grep, and that's where the failure happens, so strictly speaking this isn't an Emacs bug, but it is a problem for users of dired-do-find-regexp (dired-do-search and occur, for example, don't have this problem). One workaround is to add the -a option to the grep invocation in xref-matches-in-files; then the search succeeds and the *xref* buffer displays 'a\344'. But this doesn't work if '=C3=A4' is the search term. F= or the latter, I can get the correct output from grep by piping the output of 'iconv -f ISO-8859-1 -t UTF-8' through to it, and indeed, prepending 'iconv -f ISO-8859-1 -t UTF-8 | ' to the grep invocation in xref-matches-in-files does give the correct output in both cases. But this won't work if the file has a different non-utf-8 encoding, assuming the issue isn't specific to latin-1. Is there another alternative (aside from "Someone=E2=84=A2 can implement it in Emacs Lisp")? Steve Berman