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:46:02 +0200

> From: Lars Magne Ingebrigtsen <[email-masked]>
> Cc: Richard Copley <[email-masked]>,  [email-masked]
> Date: Sat, 23 Jan 2016 14:12:20 +0100
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Your locale's default encoding, cp1252, cannot encode this character,
> > so Emacs asked you to provide an encoding that can, and offered
> > chinese-iso-8bit as the default.
> 
> While correct, it is a slightly less than helpful default.

It's not a default, it's just the first member of a list sorted
according to some comparison function.

> Most people deal (at most) with two charsets: One local, and if not,
> then Unicode.

That's only correct if the encoded text is going to be used on the
same platform.  This email message is an excellent example where this
logic is simply false, because you and I live in different locales,
and "Unicode" means different things to us.

(Anyway, when you say "most people", did you consider how many people
in the world consider chinese-iso-8bit a very good first choice? ;-)

> Which would be utf8 on most systems, and possibly ucs16 on Windows,
> I dunno.

Using UTF-16 on Windows would be disastrous: almost no program,
certainly not those which are ports of GNU software, can do anything
useful with such an encoding.  Emacs is the only exception I know of.

> So `chinese-iso-8bit' is a surprising default.

It's not a default.

> Could the default be improved upon?

We can sort the list differently.  But if all we want is to always get
UTF-8 at the head, there's a much easier way, see my other message
where I mentioned prefer-coding-system.