bug#81606: Mojibake with UTF-8 file names
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
> Cc: [email protected], [email protected] > Date: Sun, 16 Aug 2026 17:48:21 +0300 > From: Eli Zaretskii <[email protected]> > > > Date: Sun, 16 Aug 2026 14:29:54 +0000 > > Cc: [email protected], [email protected] > > From: Werner LEMBERG <[email protected]> > > > > There might be situations where the file encoding and the file name > > encoding differ, for example on Windows. > > No, if the file name is specified by the same file that has the > 'coding:' cookie, that cannot happen. > > > I don't know enough about the encoding handling in Emacs whether it > > automatically maps UTF-8 encoded file name strings (as implied by > > the `coding` cookie) to UTF-16... > > Of course it does. How else could Emacs support arbitrary non-ASCII > characters in file names on Windows? Btw, this is not specific to Windows. Emacs always first decodes file names into the internal representation of characters in strings, and then encodes the file name when it calls libc functions to access files by name. And the two encodings -- the original one from which the file name was decoded, and the one into which we encode -- do not have to be the same. The second encoding is what Emacs calls file-name-coding-system.