bug#81606: Mojibake with UTF-8 file names
Eli Zaretskii <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
> Date: Sun, 16 Aug 2026 14:29:54 +0000 > Cc: [email protected], [email protected] > From: Werner LEMBERG <[email protected]> > > >> If a master file `foo` is specified in the local variables block, > >> AUCTeX checks whether it is exists, otherwise it gets created. > >> This string `foo` must be given in the encoding specified by the > >> `coding` cookie. > > > > But this is trivially correct: any non-ASCII text in a file which has > > a 'coding:' cookie _must_ be encoded in the encoding specified by > > 'coding:". Right? > > 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? > > If you want to require the 'coding:' cookie in all cases, that's > > fine, but then latexenc.el is not needed at all, see above. > > Well, the AUCTeX documentation doesn't require it yet — otherwise I > wouldn't have noticed the problem. I think it's a good thing if Emacs > has a heuristic fallback mechanism to handle the case without a > `coding` cookie. And for that case I think the recommendation should be to encode the file name in UTF-8.