emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117872: Decode HTML text before presenting it in Rm


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r117872: Decode HTML text before presenting it in Rmail.
Date: Sat, 13 Sep 2014 09:21:05 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117872
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/4258
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2014-09-13 12:20:15 +0300
message:
  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'.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/mail/rmailmm.el           rmailmm.el-20091113204419-o5vbwnq5f7feedwu-8815
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-13 09:01:56 +0000
+++ b/lisp/ChangeLog    2014-09-13 09:20:15 +0000
@@ -1,3 +1,8 @@
+2014-09-13  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        Support rendering of HTML parts in Rmail (bug#4258).

=== modified file 'lisp/mail/rmailmm.el'
--- a/lisp/mail/rmailmm.el      2014-09-13 09:01:56 +0000
+++ b/lisp/mail/rmailmm.el      2014-09-13 09:20:15 +0000
@@ -659,7 +659,12 @@
   "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 @@
             (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]