Subject: Re: bug#4816: change of coding system without inquiry

From: Stefan Monnier <[email-masked]>
Date: Thu, 29 Oct 2009 20:57:12 -0400

> When I edit a non-latin-1 character into a latin-1 file and then save it,
> Emacs saves the file in UTF-8 without inquiry. It omits the dialogue that
> would inform me about the offending character and would offer me to select
> a coding system for saving.
[...]
> If suppression of the dialogue is intended and not a bug: is there
> some variable with which I can specify that I want to get that
> dialogue anyway?

In Emacs-23, the preferred charset has been changed to utf-8, so when
opening a new file, we first try utf-8 (both because it's expected to
be the standard coding-system in GNU/Linux systems nowadays, and
because there are very few files that are encoded with something else
than utf-8 and yet they also happen to be valid utf-8 files).

So when saving a file in a latin-1 locale, both latin-1 and utf-8 can be
used "interchangeably" by Emacs.

There is currently no direct way to ask Emacs to prompt when changing
the coding system (probably mostly because changing it is common when
changing it from us-ascii (as used for empty files or other files
without non-ascii chars) to something else).

Could you explain the context in which this problem showed up?
(e.g. tell us why the coding system used matters, whether or not you've
specified the coding-system in a "-*-coding-*-" cookie and why, etc...)

BTW, in Emacs-23.2, the code has been slightly changed to always obey
the coding cookie in a file, so if you file has a "coding:latin-1"
cookie, then Emacs will not silently save it in any other coding-system.

        Stefan