all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Juhana Sadeharju <johanrainhill@gmail.com>
Cc: 58507@debbugs.gnu.org
Subject: bug#58507: Acknowledgement (Emacs does not preserve the coding system)
Date: Thu, 09 Feb 2023 11:52:22 +0200	[thread overview]
Message-ID: <83edqzmai1.fsf@gnu.org> (raw)
In-Reply-To: <CAByt=PfpQ2jMO-_y5TBAmEow3-N-cb+1Z2wSUF6k0-3+vTVgQg@mail.gmail.com> (message from Juhana Sadeharju on Thu, 9 Feb 2023 10:56: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	other threads:[~2023-02-09  9:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  6:02 bug#58507: Emacs does not preserve the coding system Juhana Sadeharju
2022-10-14 10:42 ` Eli Zaretskii
2022-10-24  0:22   ` Juhana Sadeharju
2022-10-24 12:45     ` Eli Zaretskii
     [not found] ` <handler.58507.B.166574069410702.ack@debbugs.gnu.org>
2023-02-09  8:56   ` bug#58507: Acknowledgement (Emacs does not preserve the coding system) Juhana Sadeharju
2023-02-09  9:52     ` Eli Zaretskii [this message]
2023-09-03  9:30       ` bug#58507: Emacs does not preserve the coding system Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83edqzmai1.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=58507@debbugs.gnu.org \
    --cc=johanrainhill@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.