Function: mm-decode-content-transfer-encoding
mm-decode-content-transfer-encoding is a byte-compiled function
defined in mm-bodies.el.gz.
Signature
(mm-decode-content-transfer-encoding ENCODING &optional TYPE)
Documentation
Decodes buffer encoded with ENCODING, returning success status.
If TYPE is text/plain CRLF->LF translation may occur.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/mm-bodies.el.gz
;;;
;;; Functions for decoding
;;;
(defun mm-decode-content-transfer-encoding (encoding &optional type)
"Decodes buffer encoded with ENCODING, returning success status.
If TYPE is `text/plain' CRLF->LF translation may occur."
(prog1
(condition-case error
(cond
((eq encoding 'quoted-printable)
(quoted-printable-decode-region (point-min) (point-max))
t)
((eq encoding 'base64)
;; MIME says to ignore any non-base64 junk
(base64-decode-region (point-min) (point-max) nil t))
((memq encoding '(nil 7bit 8bit binary))
;; Do nothing.
t)
((memq encoding '(x-uuencode x-uue))
(require 'mm-uu)
(funcall mm-uu-decode-function (point-min) (point-max))
t)
((eq encoding 'x-binhex)
(require 'mm-uu)
(funcall mm-uu-binhex-decode-function (point-min) (point-max))
t)
((eq encoding 'x-yenc)
(require 'mm-uu)
(funcall mm-uu-yenc-decode-function (point-min) (point-max))
)
((functionp encoding)
(funcall encoding (point-min) (point-max))
t)
(t
(message "Unknown encoding %s; defaulting to 8bit" encoding)))
(error
(message "Error while decoding: %s" error)
nil))
(when (and
type
(memq encoding '(base64 x-uuencode x-uue x-binhex x-yenc))
(string-match "\\`text/" type))
(goto-char (point-min))
(while (search-forward "\r\n" nil t)
(replace-match "\n" t t)))))