From: Jason Rumney Date: Mon, 18 Feb 2008 02:41:11 +0000 (+0000) Subject: (xml-find-file-coding-system): Don't warn about utf-16 with BOM. X-Git-Tag: emacs-pretest-23.0.90~7881 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=228de8de4f72d92bdf4b3395086c826933ab6a72;p=emacs.git (xml-find-file-coding-system): Don't warn about utf-16 with BOM. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7c814c4c2e3..24800d3bad1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2008-02-18 Jason Rumney + * international/mule.el (xml-find-file-coding-system): Don't warn + about utf-16 with BOM. + * nxml/nxml-mode.el (nxml-mode): Don't add a write-contents-hook. * international/mule.el (sgml-xml-auto-coding-function): Detect diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 7952c7a6878..d6305814a09 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el @@ -2341,12 +2341,16 @@ added by processing software." (coding-system-base (detect-coding-region (point-min) (point-max) t))))) ;; Pure ASCII always comes back as undecided. - (if (memq detected '(utf-8 undecided)) - 'utf-8 + (cond + ((memq detected '(utf-8 undecided)) + 'utf-8) + ((eq detected 'utf-16le-with-signature) 'utf-16le-with-signature) + ((eq detected 'utf-16be-with-signature) 'utf-16be-with-signature) + (t (warn "File contents detected as %s. Consider adding an xml declaration with the encoding specified, or saving as utf-8, as mandated by the xml specification." detected) - detected)) + detected))) ;; Don't interfere with the user's wishes for saving the buffer. ;; We did what we could when the buffer was created to ensure the ;; correct encoding was used, or the user was warned, so any