From 41de25c1134e201235ac7f6e19ecb2925a7df635 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Thu, 9 Feb 2017 00:41:19 +0000 Subject: [PATCH] Make mm-shr use mail-parse-charset by default * lisp/gnus/mm-decode.el (mm-shr): Use mail-parse-charset by default. This helps an html message with no charset spec to be decoded. --- lisp/gnus/mm-decode.el | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 579222f0f65..989d4b8ea17 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1793,22 +1793,23 @@ If RECURSIVE, search recursively." (buffer-string)))))) (shr-inhibit-images mm-html-inhibit-images) (shr-blocked-images mm-html-blocked-images) - charset char) + charset coding char) (unless handle (setq handle (mm-dissect-buffer t))) - (setq charset (mail-content-type-get (mm-handle-type handle) 'charset)) + (and (setq charset + (or (mail-content-type-get (mm-handle-type handle) 'charset) + mail-parse-charset)) + (setq coding (mm-charset-to-coding-system charset nil t)) + (eq coding 'ascii) + (setq coding nil)) (save-restriction (narrow-to-region (point) (point)) (shr-insert-document (mm-with-part handle (insert (prog1 - (if (and charset - (setq charset - (mm-charset-to-coding-system charset - nil t)) - (not (eq charset 'ascii))) - (decode-coding-string (buffer-string) charset) - (string-as-multibyte (buffer-string))) + (if coding + (decode-coding-string (buffer-string) coding) + (buffer-string)) (erase-buffer) (mm-enable-multibyte))) (goto-char (point-min)) -- 2.39.2