Subject: Re: bug#10383: 24.0.91; (prefer-coding-system 'utf-8-with-signature) breaks the world

From: Stefan Monnier <[email-masked]>
Date: Wed, 28 Dec 2011 05:49:53 -0500

> This is because utf-8-with-signature is recognized as ASCII
> compatible and thus default-file-coding-system is also set
> to it.  I've just committed a fix to make
> utf-8-with-signature not ASCII compatible.  Please try
> again with the latest trunk code.

That looks like a good fix.

> By the way, as a result, now
>     (prefer-coding-system 'utf-8-with-signature)
> does not change default-file-coding-system.

That's fine.  A call to `message' might be a good addition to help the
user understand that his config might not be doing what she expects.

> I'm not sure what is the intention of preferring utf-8-with-signature,
> one may want default-file-coding-system be set to utf-8 in such
> a case.

I wouldn't waste too much time on it.

> But, doing that automatically is too heuristic.  Another possibility
> is that what actually wanted is such a coding as
> utf-8-with-signature-on-decoding-only (i.e. on decoding, BOM is
> recognized, but on encoding, don't produce BOM).

Not necessarily.  My guess is that the user doesn't realize that
coding-systems are not only used to load and save whole files but also
on chunks of texts in lots of other cases, where a BOM doesn't make
any sense.

        Stefan