Function: mail-quote-printable
mail-quote-printable is an autoloaded and byte-compiled function
defined in mail-utils.el.gz.
Signature
(mail-quote-printable STRING &optional WRAPPER)
Documentation
Convert a string to the "quoted printable" Q encoding if necessary.
If the string contains only ASCII characters and no troublesome ones, we return it unconverted.
If the optional argument WRAPPER is non-nil, we add the wrapper characters =?ISO-8859-1?Q?....?=.
Source Code
;; Defined in /usr/src/emacs/lisp/mail/mail-utils.el.gz
;;;###autoload
(defun mail-quote-printable (string &optional wrapper)
"Convert a string to the \"quoted printable\" Q encoding if necessary.
If the string contains only ASCII characters and no troublesome ones,
we return it unconverted.
If the optional argument WRAPPER is non-nil,
we add the wrapper characters =?ISO-8859-1?Q?....?=."
(let ((i 0) (result ""))
(save-match-data
(while (or (string-match "[?=\"]" string i)
(string-match "[^\000-\177]" string i))
(setq result
(concat result (substring string i (match-beginning 0))
(upcase (format "=%02x"
(aref string (match-beginning 0))))))
(setq i (match-end 0)))
(if wrapper
(concat "=?ISO-8859-1?Q?"
result (substring string i)
"?=")
(concat result (substring string i))))))