RFC 2781 under "4.3 Interpreting text labelled as UTF-16" says is that if a document is labelled "UTF-16", the application should check the byte order mark to see if it is little endian or big endian Only if there's no byte order mark, should the document be interpreted as big endian. ________________________________ From: Eli Zaretskii Sent: Saturday, May 18, 2019 5:33 AM To: J S Cc: npostavs@gmail.com; 35766@debbugs.gnu.org Subject: Re: bug#35766: emacs saves utf-16 le xml files as utf-16 be > From: J S > CC: "npostavs@gmail.com" , "35766@debbugs.gnu.org" > <35766@debbugs.gnu.org> > Date: Fri, 17 May 2019 20:16:41 +0000 > > For example, if I save this xml file in emacs, it saves it as utf-16 big endian: > > This is the Emacs default, which is well documented, and is also according to what the UTF-16 spec (RFC 2781) says. > If I do this in powershell (really a .net method), it saves it as utf-16 little endian (osx or windows): Then PowerShell behaves in violation of RFC 2781.