Subject: bug#15426: 24.3.50; Multibyte filenames and directory-files in unibyte buffer

From: Andreas Politz <[email-masked]>
Date: Sat, 21 Sep 2013 11:35:52 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Andreas Politz <[email-masked]>
>> 
>> (let ((d "/tmp/\303\204")) ;; utf-8 for german umlaut "A 
>
> This makes d a unibyte string:
>
>   (setq d "/tmp/\303\204")
>   "/tmp/\303\204"
>
>   (multibyte-string-p d)
>     => nil
>
> Why would one do such a thing in the first place?

OK.  The thing is that Emacs does it.

If I save this in mb-dir/foo.el, where mb-dir is a directory containing
multi-bytes, the results (d1 and d2) of the same calls to
`directory-list' are different in the uni-byte and multi-byte buffer. It
seems that the 2 byte sequences of the UTF-8 characters are replaced by
some 4 bytes. Anyway, the resulting filename d2 names a non-existent
file.

> "The minibuffer displays" is the key point here:[...]

No, the key is that the file's existence depends on the buffer's
multi-byte status, in which the code is evaluated.

>
>> I hope that clarifies it.

-ap