Commit ec6f5889 authored by Eli Zaretskii's avatar Eli Zaretskii

Better support utf-8-with-signature and utf-8-hfs in HTML

* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
Support UTF-8 with BOM and utf-8-hfs as variants of UTF-8, and
obey the buffer's encoding if it is one of these variants, instead
of re-encoding in UTF-8 proper.  (Bug#20623)
parent eb026a8d
......@@ -2544,7 +2544,17 @@ This function is intended to be added to `auto-coding-functions'."
(let* ((match (match-string 2))
(sym (intern (downcase match))))
(if (coding-system-p sym)
;; If the encoding tag is UTF-8 and the buffer's
;; encoding is one of the variants of UTF-8, use the
;; buffer's encoding. This allows, e.g., saving an
;; HTML file as UTF-8 with BOM when the tag says UTF-8.
(let ((sym-type (coding-system-type sym))
(coding-system-type buffer-file-coding-system)))
(if (and (coding-system-equal 'utf-8 sym-type)
(coding-system-equal 'utf-8 bfcs-type))
(message "Warning: unknown coding system \"%s\"" match)
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