Function: mh-decode-message-body

mh-decode-message-body is a byte-compiled function defined in mh-mime.el.gz.

Signature

(mh-decode-message-body)

Documentation

Decode message based on charset.

If message has been encoded for transfer take that into account.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-mime.el.gz
(defun mh-decode-message-body ()
  "Decode message based on charset.
If message has been encoded for transfer take that into account."
  (let (ct charset cte)
    (goto-char (point-min))
    (re-search-forward "\n\n" nil t)
    (save-restriction
      (narrow-to-region (point-min) (point))
      (setq ct (ignore-errors (mail-header-parse-content-type
                               (message-fetch-field "Content-Type" t)))
            charset (mail-content-type-get ct 'charset)
            cte (message-fetch-field "Content-Transfer-Encoding")))
    (when (stringp cte) (setq cte (mail-header-strip-cte cte)))
    (when (or (not ct) (equal (car ct) "text/plain"))
      (save-restriction
        (narrow-to-region (min (1+ (mh-mail-header-end)) (point-max))
                          (point-max))
        (mm-decode-body charset
                        (and cte (intern (downcase cte)))
                        (car ct))))))