]> git.eshelyaron.com Git - emacs.git/commitdiff
Decode HTML text before presenting it in Rmail.
authorEli Zaretskii <eliz@gnu.org>
Sat, 13 Sep 2014 09:20:15 +0000 (12:20 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 13 Sep 2014 09:20:15 +0000 (12:20 +0300)
 lisp/mail/rmailmm.el (rmail-mime-insert-html): Decode the HTML part
 using the specified transfer-encoding, if any, or 'undecided'.

Fixes: debbugs:4258
lisp/ChangeLog
lisp/mail/rmailmm.el

index 59edd98477409783ea4817b53c72b62a337d02ff..e79f8563b49750b9ea84611b789a141e9e0ad1e3 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * mail/rmailmm.el (rmail-mime-insert-html): Decode the HTML part
+       using the specified transfer-encoding, if any, or 'undecided'.
+
 2013-12-27  Ken Olum  <kdo@cosmos.phy.tufts.edu>
 
        Support rendering of HTML parts in Rmail (bug#4258).
index f28089762e61b1138b1bcc1f41cd70db2aad2fed..becfb2f8cab668d6377ace05cbf9040a258ed8a2 100644 (file)
@@ -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