]> git.eshelyaron.com Git - emacs.git/commitdiff
Make mm-shr use mail-parse-charset by default
authorKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 9 Feb 2017 00:41:19 +0000 (00:41 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 9 Feb 2017 00:41:19 +0000 (00:41 +0000)
* 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

index 579222f0f6538cfd388b6d49a962f1ae0d75b69c..989d4b8ea178d36692ca576f9b2364cdf7c066c3 100644 (file)
@@ -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))