[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Encoding trouble
From: |
Arash Esbati |
Subject: |
Re: Encoding trouble |
Date: |
Tue, 01 Feb 2022 12:08:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 |
Denis Bitouzé <denis.bitouze@univ-littoral.fr> writes:
> several years ago, I already faced the following problem and,
> unfortunately, it happened again yesterday, which made me lose quite
> some time.
>
> Let me explain myself: I had a LaTeX file encoded in latin1 that
> I wanted to encode in UTF-8. I used an external tool, in this case
> `utrac`,
I think Emacs got upset because it saw you used an external tool --
hence the punishment 😉
> which confirmed the starting (latin1) and ending (UTF-8)
> encoding. But, when I opened this file in Emacs with AUCTeX enabled,
> the accented characters were wrong and it was only when I saw that the
> file contained `usepackage[latin1]{inputenc}` that I understood where
> the problem came from: changing it in `usepackage[utf8]{inputenc}`
> solved it.
I'm not even sure that AUCTeX has code to deal with a .tex file which
already contains \usepackage[<enc>]{inputenc}. The only thing I'm aware
of is when you type 'C-c C-m usepackage RET inputenc RET ENC RET' that
AUCTeX changes the file encoding acc. to chose ENC.
> So, here is my request: would it be possible that, for the detection of
> the real encoding of the file, AUCTeX relies not on the `inputenc`
> package option, but rather on the Emacs heuristics and that, in case of
> discrepancy between the two, it issues a warning?
Have a look at the variable `file-coding-system-alist'. If you don't
want automatic conversion based on 'inputenc', remove the entry
("\\.\\(tex\\|ltx\\|dtx\\|drv\\)\\'" . latexenc-find-file-coding-system)
Maybe that helps.
Best, Arash