changeset 54990:4562a16c141d

(rmail-convert-to-babyl-format): Don't remove ^M characters left after base64 decoding. (rmail-decode-region): Use -dos variety of `coding', to remove any ^M characters left after qp or base64 decoding.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 19 Apr 2004 18:04:46 +0000
parents fef941157a2e
children 124f27703a8e
files lisp/mail/rmail.el
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Mon Apr 19 15:29:23 2004 +0000
+++ b/lisp/mail/rmail.el	Mon Apr 19 18:04:46 2004 +0000
@@ -1666,7 +1666,15 @@
 (defun rmail-decode-region (from to coding)
   (if (or (not coding) (not (coding-system-p coding)))
       (setq coding 'undecided))
-  (decode-coding-region from to coding))
+  ;; Use -dos decoding, to remove ^M characters left from base64 or
+  ;; rogue qp-encoded text.
+  (decode-coding-region from to
+			(coding-system-change-eol-conversion coding 1))
+  ;; Don't reveal the fact we used -dos decoding, as users generally
+  ;; will not expect the RMAIL buffer to use DOS EOL format.
+  (setq buffer-file-coding-system
+	(setq last-coding-system-used
+	      (coding-system-change-eol-conversion coding 0))))
 
 ;; the  rmail-break-forwarded-messages  feature is not implemented
 (defun rmail-convert-to-babyl-format ()
@@ -1751,9 +1759,6 @@
 			       (error nil))
 			   ;; Change "base64" to "8bit", to reflect the
 			   ;; decoding we just did.
-			   (goto-char (1+ header-end))
-			   (while (search-forward "\r\n" (point-max) t)
-			     (replace-match "\n"))
 			   (goto-char base64-header-field-end)
 			   (delete-region (point) (search-backward ":"))
 			   (insert ": 8bit"))))
@@ -1901,9 +1906,6 @@
 				    (point)))
 				 t)
 			     (error nil))
-			 (goto-char header-end)
-			 (while (search-forward "\r\n" (point-max) t)
-			   (replace-match "\n"))
 			 ;; Change "base64" to "8bit", to reflect the
 			 ;; decoding we just did.
 			 (goto-char base64-header-field-end)