Subject: Re: bug#21825: 2015-10-04; utf8 and latin1 coding problem in GNU emacs, Xemacs is fine

From: David Kastrup <[email-masked]>
Date: Wed, 04 Nov 2015 17:53:52 +0100

Uwe Brauer <[email-masked]> writes:

>>>> "David" == David Kastrup <[email-masked]> writes:
>
>    > Uwe Brauer <[email-masked]> writes:
>    >> Hello
>    >> 
>    >> The following problem only occurs in GNU emacs 24.5 or 25.0.50.
>    >> 
>    >> I have two files:
>    >> 
>    >> The first is saved in latin-1 but its header state
>    >> \usepackage[utf8]{inputenc}
>    >> 
>    >> And the other is the other way around
>    >> saved in UTF8 header is 
>    >> 
>    >> \usepackage[latin1]{inputenc}
>    >> 
>    >> 
>    >> Both are displayed correctly in Xemacs and but not in GNU emacs.
>
>    > I have a hard time understanding what you mean by "displayed correctly"
>    > when the display does not correspond to what LaTeX would output.
>
>
> I thought, that sending the latex files would have been enough. I attach
> the screenshots.
>
>
>    > Why are you lying to LaTeX/Emacs about the document encoding?
>    > And what do you hope to achieve by Emacs ignoring this?
>
> This is not on purpose of course, so this could occur if one has
> either a very large header and forgets what coding has been selected
> (this is lame I know) or more realistically you have a multi file
> documentation and don't recall its encoding.
>
> However there is one thing I just have to add. Maybe I was «spoiled»
> in the past by Xemacs/x-symbol behavior which displayed any coding
> correctly but internally had the files saved in ascii mode. (Like
> running iso-iso2tex on every save).

So you have X-Symbol convert the buffers to pure ASCII input for LaTeX
but load the inputenc package in your document anyway, specifying some
completely random encoding that's a superset of ASCII and has nothing to
do with the buffer encoding.

> Of course thinking about it again, you are right. This is a bad habit.

I cannot rule out that X-Symbol's operation is incompatible with that of
latexenc.el.  I have a hard time considering that a bug of latexenc.el,
though.

> So this is not a bug.
>
> I could solve the issue of the wrongly displayed coding by just
> removing the incorrect header and reopening the file.
>
>
> BTW how else could this wrong coding be repaired? I am asking because
> I have encountered similar problems in non latex files, which have
> been modified by Xemacs.

You can load a file with a particular encoding by using
C-x RET c latin-1 RET C-x C-f filename RET
for example.

You can change the coding system for saving by using

C-x RET f latin-9 RET
for example.

-- 
David Kastrup