From 607e855510987c88d2197f2a52fff8a635a24776 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 10 Mar 2012 04:02:06 -0500 Subject: [PATCH] mail-utils.el: multibyte chars should be quoted. --- lisp/ChangeLog | 2 ++ lisp/mail/mail-utils.el | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0648c9dc5cd..1d225b9cd81 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-03-10 Richard Stallman + * mail/mail-utils.el (mail-quote-printable): Quote multibyte chars. + * mail/rmail.el (rmail-buffers-swapped-p): Don't assume dead view buffer means not swapped. (rmail-view-buffer-kill-buffer-hook): Give buf name in error msg. 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" -- 2.39.2