Commit 2f4e9c47 authored by Colin Walters's avatar Colin Walters
Browse files

(sgml-xml-auto-coding-function): Update with more known XML encodings.

parent 1b65564c
...@@ -1928,17 +1928,17 @@ This function is intended to be added to `auto-coding-functions'." ...@@ -1928,17 +1928,17 @@ This function is intended to be added to `auto-coding-functions'."
(when (re-search-forward "\\`[[:space:]\n]*<\\?xml") (when (re-search-forward "\\`[[:space:]\n]*<\\?xml")
(let ((end (save-excursion (let ((end (save-excursion
;; This is a hack. ;; This is a hack.
(search-forward "\"\\s-*?>" size t)))) (re-search-forward "\"\\s-*\\?>" size t))))
(when end (when end
(if (re-search-forward "encoding=\"\\(.+?\\)\"" end t) (if (re-search-forward "encoding=\"\\(.+?\\)\"" end t)
(let ((match (downcase (match-string 1)))) (let ((match (downcase (match-string 1))))
;; FIXME: what other encodings are valid, and how can we (cond ((member match '("utf-8" "iso-2022-jp"
;; translate them to the names of coding systems? "euc-jp" "shift_jis"))
(cond ((string= match "utf-8") (intern match))
'utf-8)
((string-match "iso-8859-[[:digit:]]+" match) ((string-match "iso-8859-[[:digit:]]+" match)
(intern match)) (intern match))
(t nil))) (t (message "Warning: unknown XML encoding %s" match)
nil)))
'utf-8))))) 'utf-8)))))
;;; ;;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment