From cfadea45dbc6168e97f464956b8fc5c84103ecb3 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Tue, 5 Oct 2010 02:08:37 +0000 Subject: [PATCH] mm-decode.el (mm-shr): Decode contents by charset. --- lisp/gnus/ChangeLog | 4 ++++ lisp/gnus/mm-decode.el | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a2371a51b48..96e0cc20f9e 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2010-10-05 Katsumi Yamaoka + + * mm-decode.el (mm-shr): Decode contents by charset. + 2010-10-04 Lars Magne Ingebrigtsen * shr.el (shr-tag-blockquote): Ensure paragraph after quote, too. diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index ab96e349bb6..edbd252c3c8 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -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) -- 2.39.5