Importing Pterodactyl Gnus v0.87.
[elisp/gnus.git-] / lisp / mm-bodies.el
index 64e6053..bcbd4f1 100644 (file)
@@ -54,7 +54,7 @@
     (gb2312 . base64)
     (cn-gb . base64)
     (cn-gb-2312 . base64)
-    (euc-kr . base64)
+    (euc-kr . 8bit)
     (iso-2022-jp-2 . base64)
     (iso-2022-int-1 . base64))
   "Alist of MIME charsets to encodings.
@@ -161,12 +161,19 @@ If no encoding was done, nil is returned."
           ((eq encoding 'quoted-printable)
            (quoted-printable-decode-region (point-min) (point-max)))
           ((eq encoding 'base64)
-           (base64-decode-region (point-min) (point-max)))
+           (base64-decode-region (point-min)
+                                 ;; Some mailers insert whitespace
+                                 ;; junk at the end which
+                                 ;; base64-decode-region dislikes.
+                                 (save-excursion
+                                   (goto-char (point-max))
+                                   (skip-chars-backward "\n\t ")
+                                   (point))))
           ((memq encoding '(7bit 8bit binary))
            )
           ((null encoding)
            )
-          ((eq encoding 'x-uuencode)
+          ((memq encoding '(x-uuencode x-uue))
            (funcall mm-uu-decode-function (point-min) (point-max)))
           ((eq encoding 'x-binhex)
            (funcall mm-uu-binhex-decode-function (point-min) (point-max)))
@@ -178,7 +185,7 @@ If no encoding was done, nil is returned."
         (message "Error while decoding: %s" error)
         nil))
     (when (and
-          (memq encoding '(base64 x-uuencode x-binhex))
+          (memq encoding '(base64 x-uuencode x-uue x-binhex))
           (equal type "text/plain"))
       (goto-char (point-min))
       (while (search-forward "\r\n" nil t)