bug#81294: dired-do-find-regexp doesn't find Umlauts

Eli Zaretskii <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> Cc: [email protected], [email protected], [email protected]
> Date: Wed, 15 Jul 2026 15:19:30 +0300
> From: Eli Zaretskii <[email protected]>
> 
> > From: Johann Höchtl <[email protected]>
> > Date: Wed, 15 Jul 2026 13:33:31 +0200
> > Cc: Juri Linkov <[email protected]>, [email protected], [email protected]
> > 
> > Because I set   (set-language-environment "UTF-8") on Windows I work around grep and encoding issues like
> > so:
> > 
> > (use-package grep
> >   :defer t
> >   :init
> >   (defun my-grep-with-universal-coding (orig-fun &rest args)
> >     (let ((coding-system-for-read 'utf-8)
> >       (coding-system-for-write 'latin-1))
> >     (apply orig-fun args)))
> >   (advice-add 'rgrep :around #'my-grep-with-universal-coding))
> > 
> > This works FOR ME but is certainly brittle in many regards:
> 
> Yes, as expected.
> 
> > * works just for rgrep. Not for places like lgrep, project-find-regexp and likes, dired-do-find-regexp and likes.
> > Sure, the same logic could be used for these commands as well.
> > * makes assumptions about my input encoding and output encoding. latin-1 because of my particular windows
> > codepage (could be automatically obtained: locale-coding-system? ) and utf-8 because all my files are utf-8
> > (could as well be automatically obtained: buffer-file-coding-system? )
> > 
> > The underlying issue is that the encoded string provided as a command line parameter to find/grep set from the
> > minibuffer within emacs is utf-8 encoded, where (as it seems) MSYS2 find/grep expect this to be encoded
> > according to the system encoding. Some layer, I do not know which one, then performs an encoding translation
> > utf-8 --> (active windows codepage) and this results in a mismatch grep is no longer able to resolve.
> 
> That "some layer" is Windows APIs: internally, everything works in
> UTF-16, and is converted to/from that to the "relevant" codepage when
> a program uses non-Unicode APIs.
> 
> > Strangely, changing the codepage to chcp.com 65001, starting a new shell, starting emacs, starting a shell
> > within emacs and calling chcp, reports 1252.
> 
> That's because Emacs overrides what you do with the system's ANSI
> codepage.  To avoid that, you need to change the system-wide codepage
> setting to 65001.
> 
> It's a mess.

I think it's time to close this bug now.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.