bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58507: Acknowledgement (Emacs does not preserve the coding system)


From: Eli Zaretskii
Subject: bug#58507: Acknowledgement (Emacs does not preserve the coding system)
Date: Thu, 09 Feb 2023 11:52:22 +0200

> From: Juhana Sadeharju <johanrainhill@gmail.com>
> Date: Thu, 9 Feb 2023 10:56:22 +0200
> 
> Hello. Has this bug or feature been fixed?

We made no change to Emacs due to this report, since I don't believe
there's a bug here.  This is how Emacs behaves, and this behavior is
well documented and intended.

In previous discussion of this issue, I pointed out how to deal with
such situations; I repeat some of that below.

> The problem is that Emacs doesn't keep the coding system I have
> set (utf-8).

The information about the file's encoding, if you want to keep it,
should be in the file, using the 'coding:' cookie, by adding

  ";;; -*- coding: utf-8-dos; -*-"

in the first line of the file.  (You can also do this in the file's
Local Variables section near the end of the file; see the "Specifying
File Variables" node of the Emacs user manual for details.

Alternatively, you can force Emacs to use UTF-8 when you visit the
file:

  C-x RET c utf-8 RET C-x C-f <file name> RET

The "C-x RET c utf-8 RET" prefix forces the following command to use
UTF-8 for decoding and encoding text.

> The file is opened with different coding system and all รครถ chars are a mess. 
> Even I set the coding
> system again to utf-8, all the mess remains. Fixing the mess does not help 
> because the next time the coding
> system is wrong again.
> 
> Why Emacs doesn't let user to decide what is the coding system for the file?

It does, see above.

> I'm actually scared to use Emacs anymore because Emacs has converted 
> thousands lines of text to a
> mess because of this bug.

As long as you only visit the file and don't make any changes to it,
the "mess" on the screen is just a display problem; the file's
contents is not changed.

> There was a trick to fix the coding system by inserting commands to the start 
> of file, so I suggest to add a
> command like "fix the coding system to file" which adds the trick thing to 
> the file. I keep forgetting the trick.

The command is "C-x RET r".  This re-reads the file after prompting
you for the coding-system to decode the file's contents.  Which is yet
another alternative to "fix" the problem after you visit the file and
notice the incorrect guess of its coding-system.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]