Subject: bug#35766: emacs saves utf-16 le xml files as utf-16 be

From: J S <[email-masked]>
Date: Fri, 17 May 2019 16:57:23 +0000

When an xml file just says encoding="UTF-16", how does an application pick big endian vs little endian?

________________________________
From: [email-masked] <[email-masked]>
Sent: Friday, May 17, 2019 4:27 PM
To: Eli Zaretskii
Cc: Noam Postavsky; [email-masked]; [email-masked]
Subject: Re: bug#35766: emacs saves utf-16 le xml files as utf-16 be

Eli Zaretskii <[email-masked]> writes:

> Perhaps we should by default produce encoding with BOM when XML header
> specifies UTF-16?

I think yes, https://www.w3.org/TR/xml/#charencoding says

    Entities encoded in UTF-16 MUST [...] begin with the Byte Order Mark

By the way, is Bug#8282 the same as this one, or just closely related?
It's talking about sgml-html-meta-auto-coding-function (though maybe
sgml-xml-auto-coding-function is more relevant).  I'm getting a little
confused between all the different *-find/auto-coding-* functions.
There is also nxml-set-auto-coding which seems to be mostly unused.