diff options
| author | Eli Zaretskii | 2014-09-13 12:20:15 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-09-13 12:20:15 +0300 |
| commit | cac270ffcd23c0aa18f0af965742645e7f3bdb04 (patch) | |
| tree | fa1f16bafed2d7a57501b676e00b5d9fba78bead | |
| parent | cea1424e92494e1933f16e3e3c266be75d188e35 (diff) | |
| download | emacs-cac270ffcd23c0aa18f0af965742645e7f3bdb04.tar.gz emacs-cac270ffcd23c0aa18f0af965742645e7f3bdb04.zip | |
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
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/mail/rmailmm.el | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 59edd984774..e79f8563b49 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-09-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * mail/rmailmm.el (rmail-mime-insert-html): Decode the HTML part | ||
| 4 | using the specified transfer-encoding, if any, or 'undecided'. | ||
| 5 | |||
| 1 | 2013-12-27 Ken Olum <kdo@cosmos.phy.tufts.edu> | 6 | 2013-12-27 Ken Olum <kdo@cosmos.phy.tufts.edu> |
| 2 | 7 | ||
| 3 | Support rendering of HTML parts in Rmail (bug#4258). | 8 | Support rendering of HTML parts in Rmail (bug#4258). |
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 | |||
| 659 | "Decode, render, and insert html from MIME-entity ENTITY." | 659 | "Decode, render, and insert html from MIME-entity ENTITY." |
| 660 | (let ((body (rmail-mime-entity-body entity)) | 660 | (let ((body (rmail-mime-entity-body entity)) |
| 661 | (transfer-encoding (rmail-mime-entity-transfer-encoding entity)) | 661 | (transfer-encoding (rmail-mime-entity-transfer-encoding entity)) |
| 662 | (buffer (current-buffer))) | 662 | (charset (cdr (assq 'charset (cdr (rmail-mime-entity-type entity))))) |
| 663 | (buffer (current-buffer)) | ||
| 664 | coding-system) | ||
| 665 | (if charset (setq coding-system (coding-system-from-name charset))) | ||
| 666 | (or (and coding-system (coding-system-p coding-system)) | ||
| 667 | (setq coding-system 'undecided)) | ||
| 663 | (with-temp-buffer | 668 | (with-temp-buffer |
| 664 | (set-buffer-multibyte nil) | 669 | (set-buffer-multibyte nil) |
| 665 | (setq buffer-undo-list t) | 670 | (setq buffer-undo-list t) |
| @@ -669,6 +674,11 @@ HEADER is a header component of a MIME-entity object (see | |||
| 669 | (ignore-errors (base64-decode-region (point-min) (point-max)))) | 674 | (ignore-errors (base64-decode-region (point-min) (point-max)))) |
| 670 | ((string= transfer-encoding "quoted-printable") | 675 | ((string= transfer-encoding "quoted-printable") |
| 671 | (quoted-printable-decode-region (point-min) (point-max)))) | 676 | (quoted-printable-decode-region (point-min) (point-max)))) |
| 677 | (decode-coding-region (point-min) (point) coding-system) | ||
| 678 | (if (and | ||
| 679 | (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system)) | ||
| 680 | (not (eq (coding-system-base coding-system) 'us-ascii))) | ||
| 681 | (setq rmail-mime-coding-system coding-system)) | ||
| 672 | ;; Convert html in temporary buffer to text and insert in original buffer | 682 | ;; Convert html in temporary buffer to text and insert in original buffer |
| 673 | (let ((source-buffer (current-buffer))) | 683 | (let ((source-buffer (current-buffer))) |
| 674 | (with-current-buffer buffer | 684 | (with-current-buffer buffer |