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 13:19:05 +0000
> Cc: [email protected], [email protected]
> From: Werner LEMBERG <[email protected]>
> 
> >>   Non-ASCII characters in the name of of the master file must use
> >>   the same encoding as the current input file itself.  To make this
> >>   actually work, set the @code{coding} local variable accordingly;
> >>   in most cases, you want to use UTF-8 encoding.  Example:
> > 
> > This doesn't work, I think: the encoding of the current file is not
> > known when latexenc looks for the name of the main file.  That was
> > the reason for the original problem in this bug.  Or what am I
> > missing?
> 
> 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?  The cookie guarantees that the entire file,
including the Local Variables section, uses that single encoding.

Moreover, if there is a 'coding:' cookie, there's no need for
latexenc.el to look for anything else to determine the encoding.  In
fact, latexenc.el is not needed at all in this case, because the
'coding:' cookie is processed and acted upon by default when a file is
visited by Emacs.

> In other words, the encoding *is* known; the user should
> specify it explicitly so that Emacs doesn't select the wrong encoding
> accidentally.

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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.