changeset 91926:d2f0754ed2f5

(xml-find-file-coding-system): Don't warn about utf-16 with BOM.
author Jason Rumney <jasonr@gnu.org>
date Mon, 18 Feb 2008 02:40:38 +0000
parents 70ae8b5ec55d
children 2e06c701088c
files lisp/international/mule.el
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule.el	Mon Feb 18 02:21:44 2008 +0000
+++ b/lisp/international/mule.el	Mon Feb 18 02:40:38 2008 +0000
@@ -2341,12 +2341,16 @@
                (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