From: yamaoka Date: Wed, 28 May 2003 22:23:10 +0000 (+0000) Subject: Synch to Gnus 200305282230. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3fb0374e85e4a510ac2cf002fabfae754658cbc;p=elisp%2Fgnus.git- Synch to Gnus 200305282230. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 216ccec..ad001a9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2003-05-28 Dave Love + + * rfc2047.el (rfc2047-encode-region): Skip ASCII at beginning and + end of region. + 2003-05-28 Jesper Harder * lpath.el: Add put-char-table and get-char-table. diff --git a/lisp/rfc2047.el b/lisp/rfc2047.el index a5e39ed..afa9ebe 100644 --- a/lisp/rfc2047.el +++ b/lisp/rfc2047.el @@ -290,13 +290,23 @@ Dynamically bind `rfc2047-encoding-type' to change that." (save-restriction (narrow-to-region b e) (if (eq 'mime rfc2047-encoding-type) - ;; Simple case -- treat as single word. + ;; Simple case. Treat as single word after any initial ASCII + ;; part and before any tailing ASCII part. The leading ASCII + ;; is relevant for instance in Subject headers with `Re:' for + ;; interoperability with non-MIME clients, and we might as + ;; well avoid the tail too. (progn (goto-char (point-min)) ;; Does it need encoding? - (skip-chars-forward "\000-\177" e) + (skip-chars-forward "\000-\177") (unless (eobp) - (rfc2047-encode b e))) + (skip-chars-backward "^ \n") ; beginning of space-delimited word + (rfc2047-encode (point) (progn + (goto-char e) + (skip-chars-backward "\000-\177") + (skip-chars-forward "^ \n") + ;; end of space-delimited word + (point))))) ;; `address-mime' case -- take care of quoted words, comments. (with-syntax-table rfc2047-syntax-table (let ((start) ; start of current token @@ -580,6 +590,12 @@ By default, the region is treated as containing addresses (see ;; Also check whether it needs to worry about delimiting fields like ;; encoding. +;; In fact it's reported that (invalid) encoding of mailboxes in +;; addr-specs is in use, so delimiting fields might help. Probably +;; not decoding a word which isn't properly delimited is good enough +;; and worthwhile (is it more correct or not?), e.g. something like +;; `=?iso-8859-1?q?foo?=@'. + (defun rfc2047-decode-region (start end) "Decode MIME-encoded words in region between START and END." (interactive "r")