summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2004-04-19 18:06:51 +0000
committerEli Zaretskii <eliz@gnu.org>2004-04-19 18:06:51 +0000
commit177cd3b9f4881410dcd5ef9e8fc706421e63c109 (patch)
treed093bbaa21e4a6f899e666f281e49c330a4dcacf /lisp/mail
parent98a51048c93fcca49095248037a63dacb14dc3b0 (diff)
downloademacs-177cd3b9f4881410dcd5ef9e8fc706421e63c109.tar.gz
(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.
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/rmail.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index f5f6262435a..0dfa43d0cc8 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1666,7 +1666,15 @@ It returns t if it got any new messages."
(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 @@ It returns t if it got any new messages."
(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 @@ It returns t if it got any new messages."
(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)