>>>>> On Tue, 16 Mar 2010, Robert Marshall wrote:

> started with emacs -q I still see the extra spaces

> Subject: =?iso-8859-1?Q?RE:_Club_F?= =?iso-8859-1?Q?ranco_Brit?=
>  =?iso-8859-1?Q?annique_de?= =?iso-8859-1?Q?_Macclesfi?=
>  =?iso-8859-1?Q?eld__D=C3=AEne?= =?iso-8859-1?Q?r_Annuel?=

I wonder why the sender's MUA would break the subject in the middle of
words? Looks like broken behaviour.

However, if I read RFC 2047 correctly, the subject above still
complies to the standard, and the whitespace should be ignored:

| When displaying a particular header field that contains multiple
| 'encoded-word's, any 'linear-white-space' that separates a pair of
| adjacent 'encoded-word's is ignored.

> giving

>  "RE: Club F ranco Brit annique de  Macclesfi eld  Dîne r Annuel"

Does attached patch fix the problem for you?

(BTW, there is quite some code duplication between functions
vm-decode-mime-message-headers and vm-decode-mime-encoded-words.
I wonder if we should do something about it.)

Ulrich

--- vm-mime.el~
+++ vm-mime.el
@@ -831,7 +831,8 @@
 (defun vm-decode-mime-encoded-words ()
   (let ((case-fold-search t)
        (buffer-read-only nil)
-       charset need-conversion encoding match-start match-end start end)
+       charset need-conversion encoding match-start match-end start end
+       previous-end)
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward vm-mime-encoded-word-regexp nil t)
@@ -848,6 +849,11 @@
                 (not (setq need-conversion
                            (vm-mime-can-convert-charset charset))))
            nil
+         ;; suppress whitespace between encoded words.
+         (and previous-end
+              (string-match "\\`[ \t\n]*\\'"
+                            (buffer-substring previous-end match-start))
+              (setq match-start previous-end))
          (delete-region end match-end)
          (condition-case data
              (cond ((string-match "B" encoding)
@@ -865,6 +871,7 @@
                              charset start end)))
          (vm-mime-charset-decode-region charset start end)
          (goto-char end)
+         (setq previous-end end)
          (delete-region match-start start))))))
 
 (defun vm-decode-mime-encoded-words-in-string (string)
_______________________________________________
Mailing list: https://launchpad.net/~vm
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~vm
More help   : https://help.launchpad.net/ListHelp

Reply via email to