Subject: Re: bug#22436: read-coding-system uses wrong default when called from write-file

From: Eli Zaretskii <[email-masked]>
Date: Sat, 23 Jan 2016 15:09:39 +0200

> From: Richard Copley <[email-masked]>
> Date: Sat, 23 Jan 2016 11:53:13 +0000
> Cc: [email-masked]
> 
> Thanks for explaining that. I imagined Emacs would use a
> heuristic based on the contents of the file.

There is indeed a heuristic, but it's not very smart, and only works
well when the encoding is blatantly clear.  This is an area where
improvements are welcome.  In any case, when presented with a buffer
that includes a single non-ASCII character that can be encoded by a
dozen of possible encodings, it's hard to be too smart based on the
contents alone.

> If there were a fallback ordering that preferred utf-8 or some
> other universally applicable coding system it would be easier
> for most users and less confusing for beginners.

Such a fallback does exist, see coding-system-priority-list.  What
"M-x prefer-coding-system RET" does is manipulate the priorities so
that the encoding you typed is preferred.

Do we close this report, or is there something else to do about it?

Thanks.