# HG changeset patch # User Katsumi Yamaoka # Date 1286244517 0 # Node ID 5613a6649f7283130fa1d8bffdc2c8f2e6db09e6 # Parent 0333270eb3dcd65fe87c5b359676fd5c271e9187 mm-decode.el (mm-shr): Decode contents by charset. diff -r 0333270eb3dc -r 5613a6649f72 lisp/gnus/ChangeLog --- a/lisp/gnus/ChangeLog Tue Oct 05 01:23:11 2010 +0000 +++ b/lisp/gnus/ChangeLog Tue Oct 05 02:08:37 2010 +0000 @@ -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 -r 0333270eb3dc -r 5613a6649f72 lisp/gnus/mm-decode.el --- a/lisp/gnus/mm-decode.el Tue Oct 05 01:23:11 2010 +0000 +++ b/lisp/gnus/mm-decode.el Tue Oct 05 02:08:37 2010 +0000 @@ -1679,14 +1679,27 @@ (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)