]> code.delx.au - gnu-emacs/commitdiff
mm-decode.el (mm-shr): Decode contents by charset.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 5 Oct 2010 02:08:37 +0000 (02:08 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 5 Oct 2010 02:08:37 +0000 (02:08 +0000)
lisp/gnus/ChangeLog
lisp/gnus/mm-decode.el

index a2371a51b480527244903d0706c4e441aed7368b..96e0cc20f9e1bfb5796efb599d342300984818d6 100644 (file)
@@ -1,3 +1,7 @@
+2010-10-05  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-decode.el (mm-shr): Decode contents by charset.
+
 2010-10-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too.
index ab96e349bb6e64d93f2e47cf2c50a8ac0f60a442..edbd252c3c8f80bbb12011392f9e7db996094000 100644 (file)
@@ -1679,14 +1679,27 @@ If RECURSIVE, search recursively."
         (and (eq (mm-body-7-or-8) '7bit)
              (not (mm-long-lines-p 76))))))
 
+(declare-function libxml-parse-html-region "xml.c"
+                 (start end &optional base-url))
+(declare-function shr-insert-document "shr" (dom))
+
 (defun mm-shr (handle)
-  (let ((article-buffer (current-buffer)))
+  (let ((article-buffer (current-buffer))
+       charset)
     (unless handle
       (setq handle (mm-dissect-buffer t)))
+    (setq charset (mail-content-type-get (mm-handle-type handle) 'charset))
     (save-restriction
       (narrow-to-region (point) (point))
       (shr-insert-document
        (mm-with-part handle
+        (when (and charset
+                   (setq charset (mm-charset-to-coding-system charset))
+                   (not (eq charset 'ascii)))
+          (insert (prog1
+                      (mm-decode-coding-string (buffer-string) charset)
+                    (erase-buffer)
+                    (mm-enable-multibyte))))
         (libxml-parse-html-region (point-min) (point-max)))))))
 
 (provide 'mm-decode)