Importing pgnus-0.25.
[elisp/gnus.git-] / lisp / mm-bodies.el
index c74994e..0e6640b 100644 (file)
@@ -51,14 +51,8 @@ If no encoding was done, nil is returned."
        charsets)
        ;; We encode.
        (t
-       (let ((mime-charset
-              (or
-               (coding-system-get
-                (get-charset-property (car charsets) 'prefered-coding-system)
-                'mime-charset)
-               (car (memq (car charsets)
-                          (find-coding-systems-region
-                           (point-min) (point-max))))))
+       (let ((mime-charset 
+              (mm-mime-charset (car charsets) (point-min) (point-max)))
              start)
          (when (or t
                    ;; We always decode.
@@ -95,25 +89,28 @@ If no encoding was done, nil is returned."
 ;;; Functions for decoding
 ;;;
 
+(defun mm-decode-content-transfer-encoding (encoding)
+  (cond
+   ((eq encoding 'quoted-printable)
+    (quoted-printable-decode-region (point-min) (point-max)))
+   ((eq encoding 'base64)
+    (condition-case ()
+       (base64-decode-region (point-min) (point-max))
+      (error nil)))
+   ((memq encoding '(7bit 8bit binary))
+    )
+   ((null encoding)
+    )
+   (t
+    (error "Can't decode encoding %s" encoding))))
+
 (defun mm-decode-body (charset encoding)
   "Decode the current article that has been encoded with ENCODING.
 The characters in CHARSET should then be decoded."
   (setq charset (or charset rfc2047-default-charset))
   (save-excursion
     (when encoding
-      (cond
-       ((eq encoding 'quoted-printable)
-       (quoted-printable-decode-region (point-min) (point-max)))
-       ((eq encoding 'base64)
-       (condition-case ()
-           (base64-decode-region (point-min) (point-max))
-         (error nil)))
-       ((memq encoding '(7bit 8bit binary))
-       )
-       ((null encoding)
-       )
-       (t
-       (error "Can't decode encoding %s" encoding))))
+      (mm-decode-content-transfer-encoding encoding))
     (when (featurep 'mule)
       (let (mule-charset)
        (when (and charset