summaryrefslogtreecommitdiff
path: root/lisp/mail
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2012-03-10 04:02:06 -0500
committerRichard M. Stallman <rms@gnu.org>2012-03-10 04:02:06 -0500
commit607e855510987c88d2197f2a52fff8a635a24776 (patch)
treed91476ca9c27dd15b90eec4400d9df90c53da349 /lisp/mail
parentde3bc99a8d21d742e0fea36094274b3ed85bcf11 (diff)
downloademacs-607e855510987c88d2197f2a52fff8a635a24776.tar.gz
mail-utils.el: multibyte chars should be quoted.
Diffstat (limited to 'lisp/mail')
-rw-r--r--lisp/mail/mail-utils.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index a20201fb529..9059da817b6 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -63,12 +63,16 @@ from START (inclusive) to END (exclusive)."
;;;###autoload
(defun mail-quote-printable (string &optional wrapper)
- "Convert a string to the \"quoted printable\" Q encoding.
+ "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 (string-match "[?=\"\200-\377]" string i)
+ (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"