diff options
| author | Eli Zaretskii | 2018-08-11 12:01:37 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-08-11 12:01:37 +0300 |
| commit | ec6f588940e51013435408a456c10d33ddf98fb2 (patch) | |
| tree | ebafef354a62a784381f738f155560ceaa5f6354 | |
| parent | eb026a8d1b3c0cafb987fe5ef132ff078ec79f87 (diff) | |
| download | emacs-ec6f588940e51013435408a456c10d33ddf98fb2.tar.gz emacs-ec6f588940e51013435408a456c10d33ddf98fb2.zip | |
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)
| -rw-r--r-- | lisp/international/mule.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 4d0081f5779..14888100020 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -2544,7 +2544,17 @@ This function is intended to be added to `auto-coding-functions'." | |||
| 2544 | (let* ((match (match-string 2)) | 2544 | (let* ((match (match-string 2)) |
| 2545 | (sym (intern (downcase match)))) | 2545 | (sym (intern (downcase match)))) |
| 2546 | (if (coding-system-p sym) | 2546 | (if (coding-system-p sym) |
| 2547 | sym | 2547 | ;; If the encoding tag is UTF-8 and the buffer's |
| 2548 | ;; encoding is one of the variants of UTF-8, use the | ||
| 2549 | ;; buffer's encoding. This allows, e.g., saving an | ||
| 2550 | ;; HTML file as UTF-8 with BOM when the tag says UTF-8. | ||
| 2551 | (let ((sym-type (coding-system-type sym)) | ||
| 2552 | (bfcs-type | ||
| 2553 | (coding-system-type buffer-file-coding-system))) | ||
| 2554 | (if (and (coding-system-equal 'utf-8 sym-type) | ||
| 2555 | (coding-system-equal 'utf-8 bfcs-type)) | ||
| 2556 | buffer-file-coding-system | ||
| 2557 | sym)) | ||
| 2548 | (message "Warning: unknown coding system \"%s\"" match) | 2558 | (message "Warning: unknown coding system \"%s\"" match) |
| 2549 | nil))))) | 2559 | nil))))) |
| 2550 | 2560 | ||