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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 20 Sep 2013 20:46:03 +0300

> From: Andreas Politz <[email-masked]>
> Date: Fri, 20 Sep 2013 18:47:54 +0200
> 
> There seems to be something going wrong with the
> encoding/decoding of multibyte filenames from a unibyte buffer in
> recursive calls to directory-files.
> 
> $ emacs -Q 
> 
> (setq d "/tmp/Ä")
> "/tmp/Ä"
> 
> (make-directory d t)
> nil
> 
> (toggle-enable-multibyte-characters)
> t
> 
> (car (directory-files d t))
> "/tmp/Ä/."
> 
> (car (directory-files (car (directory-files d t)) t))
> "/tmp/\301\203\300\204/."

Don't do that: inserting multibyte strings into a unibyte buffer
changes the representation of the characters in the string, so you get
a unibyte string.  Unibyte buffers should only ever hold encoded text
or binary data.

Why did you need to do something like that, and in what real-life use
case?