diff options
author | Eli Zaretskii <eliz@gnu.org> | 2014-09-13 12:20:15 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2014-09-13 12:20:15 +0300 |
commit | cac270ffcd23c0aa18f0af965742645e7f3bdb04 (patch) | |
tree | fa1f16bafed2d7a57501b676e00b5d9fba78bead /lisp/mail | |
parent | cea1424e92494e1933f16e3e3c266be75d188e35 (diff) | |
download | emacs-cac270ffcd23c0aa18f0af965742645e7f3bdb04.tar.gz |
Decode HTML text before presenting it in Rmail.
lisp/mail/rmailmm.el (rmail-mime-insert-html): Decode the HTML part
using the specified transfer-encoding, if any, or 'undecided'.
Fixes: debbugs:4258
Diffstat (limited to 'lisp/mail')
-rw-r--r-- | lisp/mail/rmailmm.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index f28089762e6..becfb2f8cab 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -659,7 +659,12 @@ HEADER is a header component of a MIME-entity object (see "Decode, render, and insert html from MIME-entity ENTITY." (let ((body (rmail-mime-entity-body entity)) (transfer-encoding (rmail-mime-entity-transfer-encoding entity)) - (buffer (current-buffer))) + (charset (cdr (assq 'charset (cdr (rmail-mime-entity-type entity))))) + (buffer (current-buffer)) + coding-system) + (if charset (setq coding-system (coding-system-from-name charset))) + (or (and coding-system (coding-system-p coding-system)) + (setq coding-system 'undecided)) (with-temp-buffer (set-buffer-multibyte nil) (setq buffer-undo-list t) @@ -669,6 +674,11 @@ HEADER is a header component of a MIME-entity object (see (ignore-errors (base64-decode-region (point-min) (point-max)))) ((string= transfer-encoding "quoted-printable") (quoted-printable-decode-region (point-min) (point-max)))) + (decode-coding-region (point-min) (point) coding-system) + (if (and + (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system)) + (not (eq (coding-system-base coding-system) 'us-ascii))) + (setq rmail-mime-coding-system coding-system)) ;; Convert html in temporary buffer to text and insert in original buffer (let ((source-buffer (current-buffer))) (with-current-buffer buffer |