GNU bug report logs - #58507
Emacs does not preserve the coding system

Previous Next

Package: emacs;

Reported by: Juhana Sadeharju <johanrainhill <at> gmail.com>

Date: Fri, 14 Oct 2022 09:45:01 UTC

Severity: normal

Tags: moreinfo, notabug

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 58507 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juhana Sadeharju <johanrainhill <at> gmail.com>
Cc: 58507 <at> debbugs.gnu.org
Subject: Re: bug#58507: Emacs does not preserve the coding system
Date: Mon, 24 Oct 2022 15:45:07 +0300
> From: Juhana Sadeharju <johanrainhill <at> gmail.com>
> Date: Mon, 24 Oct 2022 03:22:44 +0300
> Cc: 58507 <at> debbugs.gnu.org
> 
> First I create a new file with c-x c-f. By default, it has coding system iso-latin-9-dos.
> 
> I change the coding system to utf-8 via the buffer's bottombar. Char "0" changes to "U".
> 
> Then I write "äöäöäö" and quit emacs.
> 
> When I rerun the emacs and open the text, the "öä" looks wrong and coding system is back at iso-latin-9-dos.
> 
> I use Total Commander's View to verify the file is ok. The file goes wrong only if I now save the buffer.

This is expected: the short file that you created can be interpreted
both as UTF-8 and as ISO-8859-9.  When there is ambiguity in detection
of the encoding, Emacs prefers the locale-dependent defaults, which in
your case are ISO-8859-9.

> What helps is c-x ret r which asks the coding system -- I type utf-8.
> 
> Also helps when I add ";;; -*- coding: utf-8-dos; -*-" to the top of file. I will use this method as solution, but this
> is too advanced for regular users -- please check what is the problem.

These are indeed two ways of telling Emacs to visit the file as
encoded in UTF-8.




This bug report was last modified 1 year and 257 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.