diff options
| -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 | ||