From: morioka Date: Sat, 5 Jul 1997 17:18:02 +0000 (+0000) Subject: (mime-edit-normalize-body): X-Git-Tag: semi-0_96~4 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41197d6b1260b4fddba54dbd8babdb50044598b2;p=elisp%2Fsemi.git (mime-edit-normalize-body): - Protect "From " in beginning of line (insert `ESC ( B' before it if possible, otherwise encode by quoted-printable) - canonicalize line break code for base64 --- diff --git a/mime-edit.el b/mime-edit.el index 2ae0cf5..f526fbb 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -7,7 +7,7 @@ ;; Maintainer: MORIOKA Tomohiko ;; Created: 1994/08/21 renamed from mime.el ;; Renamed: 1997/2/21 from tm-edit.el -;; Version: $Revision: 0.84 $ +;; Version: $Revision: 0.85 $ ;; Keywords: MIME, multimedia, multilingual, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -122,7 +122,7 @@ ;;; (defconst mime-edit-RCS-ID - "$Id: mime-edit.el,v 0.84 1997-07-03 12:14:07 morioka Exp $") + "$Id: mime-edit.el,v 0.85 1997-07-05 17:18:02 morioka Exp $") (defconst mime-edit-version `,(get-version-string mime-edit-RCS-ID)) @@ -1979,6 +1979,33 @@ Content-Transfer-Encoding: 7bit ) (encode-mime-charset-region beg (mime-edit-content-end) charset) + ;; Protect "From " in beginning of line + (save-restriction + (narrow-to-region beg (mime-edit-content-end)) + (goto-char beg) + (if (re-search-forward "^From " nil t) + (unless encoding + (if (memq charset '(iso-2022-jp + iso-2022-jp-2 + iso-2022-int-1 + x-ctext)) + (while (progn + (replace-match "\e(BFrom ") + (re-search-forward "^From " nil t) + )) + (setq encoding "quoted-printable") + )))) + ;; canonicalize line break code + (or (member encoding '(nil "7bit" "8bit" "quoted-printable")) + (save-restriction + (narrow-to-region beg (mime-edit-content-end)) + (goto-char beg) + (while (re-search-forward "\\([^\r]\\)\n" nil t) + (replace-match + (concat (buffer-substring (match-beginning 0) + (match-end 1)) "\r\n")) + ))) + (goto-char beg) (mime-encode-region beg (mime-edit-content-end) encoding) (mime-edit-define-encoding encoding) ))