# HG changeset patch # User Richard M. Stallman # Date 1231629488 0 # Node ID e65de16571ff7acda11b244f20ecdad712ae8cf5 # Parent 86ea76dd60c9ed0f003762d6d1139936a62fa371 (mail-quote-printable-region): New function. diff -r 86ea76dd60c9 -r e65de16571ff lisp/mail/mail-utils.el --- a/lisp/mail/mail-utils.el Sat Jan 10 23:17:44 2009 +0000 +++ b/lisp/mail/mail-utils.el Sat Jan 10 23:18:08 2009 +0000 @@ -77,6 +77,26 @@ "?=") (concat result (substring string i)))))) +;;;###autoload +(defun mail-quote-printable-region (beg end &optional wrapper) + "Convert the region to the \"quoted printable\" Q encoding. +If the optional argument WRAPPER is non-nil, +we add the wrapper characters =?ISO-8859-1?Q?....?=." + (interactive "r\nP") + (save-match-data + (save-excursion + (goto-char beg) + (save-restriction + (narrow-to-region beg end) + (while (re-search-forward "[?=\"\200-\377]" nil t) + (replace-match (upcase (format "=%02x" (preceding-char))) + t t)) + (when wrapper + (goto-char beg) + (insert "=?ISO-8859-1?Q?") + (goto-char end) + (insert "?=")))))) + (defun mail-unquote-printable-hexdigit (char) (setq char (upcase char)) (if (>= char ?A)