X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b6964cb031b5aa25c34b06ba77540ab06fab2005..1dd4f26ab6c1f14628d9fcf03b0cca7e54d52302:/lisp/mail/rmailmm.el diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 120d517f55..9343b11806 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -1,6 +1,6 @@ ;;; rmailmm.el --- MIME decoding and display stuff for RMAIL -;; Copyright (C) 2006-2015 Free Software Foundation, Inc. +;; Copyright (C) 2006-2016 Free Software Foundation, Inc. ;; Author: Alexander Pohoyda ;; Alex Schroeder @@ -135,9 +135,10 @@ automatically display the image in the buffer." (cond ((fboundp 'libxml-parse-html-region) 'rmail-mime-render-html-shr) ((executable-find "lynx") 'rmail-mime-render-html-lynx) (t nil)) - "Function to convert HTML to text. Called with buffer containing HTML -extracted from message in a temporary buffer. Converts to text in current -buffer. If NIL, display HTML source." + "Function to convert HTML to text. +Called with buffer containing HTML extracted from message in a +temporary buffer. Converts to text in current buffer. If nil, +display HTML source." :group 'rmail :version "25.1" :type '(choice function (const nil))) @@ -171,7 +172,7 @@ The value is usually nil, and bound to non-nil while inserting MIME entities.") (defvar rmail-mime-searching nil - "Bound to T inside `rmail-search-mime-message' to suppress expensive + "Bound to T inside `rmail-search-mime-message' to suppress expensive operations such as HTML decoding") ;;; MIME-entity object @@ -189,7 +190,7 @@ A MIME-entity is a vector of 10 elements: TYPE and DISPOSITION correspond to MIME headers Content-Type and Content-Disposition respectively, and have this format: - \(VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...) + (VALUE (ATTRIBUTE . VALUE) (ATTRIBUTE . VALUE) ...) Each VALUE is a string and each ATTRIBUTE is a string. @@ -201,7 +202,7 @@ Content-Type: multipart/mixed; The corresponding TYPE argument must be: \(\"multipart/mixed\" - \(\"boundary\" . \"----=_NextPart_000_0104_01C617E4.BDEC4C40\")) + (\"boundary\" . \"----=_NextPart_000_0104_01C617E4.BDEC4C40\")) TRANSFER-ENCODING corresponds to MIME header Content-Transfer-Encoding, and is a lower-case string. @@ -661,6 +662,7 @@ HEADER is a header component of a MIME-entity object (see (transfer-encoding (rmail-mime-entity-transfer-encoding entity)) (charset (cdr (assq 'charset (cdr (rmail-mime-entity-type entity))))) (buffer (current-buffer)) + (case-fold-search t) coding-system) (if charset (setq coding-system (coding-system-from-name charset))) (or (and coding-system (coding-system-p coding-system)) @@ -674,6 +676,22 @@ HEADER is a header component of a MIME-entity object (see (ignore-errors (base64-decode-region (point-min) (point-max)))) ((string= transfer-encoding "quoted-printable") (quoted-printable-decode-region (point-min) (point-max)))) + ;; Some broken MUAs state the charset only in the HTML , + ;; so if we don't have a non-trivial coding-system at this + ;; point, make one last attempt to find it there. + (if (eq coding-system 'undecided) + (save-excursion + (goto-char (point-min)) + (when (re-search-forward + "^