Subject: bug#29189: 25.3; Dired does not work with binary filenames

From: Stefan Monnier <[email-masked]>
Date: Fri, 05 Jan 2018 17:16:30 -0500

> I found that the alternative patch below solves the original problem
> without any changes needed in files.el, and without introducing any
> performance hits.  Does anyone see a problem with this proposed patch?

[ With Andreas's adjustment]  It looks sane to me.

Decoding applied to multibyte text is a rather odd situation (tho I'm
surprised this problem hasn't been noticed until now).
It should very much come with a few tests to verify that
(decode-coding-string (string-to-multibyte (encode-coding-string X)))
is just a more expensive alternative to
(decode-coding-string (encode-coding-string X))).

I'd also be tempted to additionally signal an error if a non-byte
(i.e. a char that's neither ASCII nor eight-bit-byte) is found since
"decoding" in that case is meaningless.  Tho this is obviously not for
the emacs-26 branch.

        Stefan