Function: mm-decode-body

mm-decode-body is a byte-compiled function defined in mm-bodies.el.gz.

Signature

(mm-decode-body CHARSET &optional ENCODING TYPE)

Documentation

Decode the current article that has been encoded with ENCODING to CHARSET.

ENCODING is a MIME content transfer encoding. CHARSET is the MIME charset with which to decode the data after transfer decoding. If it is nil, default to mail-parse-charset.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/mm-bodies.el.gz
(defun mm-decode-body (charset &optional encoding type)
  "Decode the current article that has been encoded with ENCODING to CHARSET.
ENCODING is a MIME content transfer encoding.
CHARSET is the MIME charset with which to decode the data after transfer
decoding.  If it is nil, default to `mail-parse-charset'."
  (when (stringp charset)
    (setq charset (intern (downcase charset))))
  (when (or (not charset)
	    (eq 'gnus-all mail-parse-ignored-charsets)
	    (memq 'gnus-all mail-parse-ignored-charsets)
	    (memq charset mail-parse-ignored-charsets))
    (setq charset mail-parse-charset))
  (save-excursion
    (when encoding
      (mm-decode-content-transfer-encoding encoding type))
    (when (not (eq charset 'gnus-decoded))
      (let ((coding-system (mm-charset-to-coding-system
			    ;; Allow overwrite using
			    ;; `mm-charset-override-alist'.
			    charset nil t)))
	(if (and (not coding-system)
		 (listp mail-parse-ignored-charsets)
		 (memq 'gnus-unknown mail-parse-ignored-charsets))
	    (setq coding-system
		  (mm-charset-to-coding-system mail-parse-charset)))
	(when (and charset coding-system
		   enable-multibyte-characters
		   (or (not (eq coding-system 'ascii))
		       (setq coding-system mail-parse-charset)))
	  (decode-coding-region (point-min) (point-max) coding-system))
	(setq buffer-file-coding-system last-coding-system-used)))))