(rfc2047-encode-region): Encode bogus delimiters.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 17 Nov 2004 03:29:23 +0000 (03:29 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 17 Nov 2004 03:29:23 +0000 (03:29 +0000)
lisp/ChangeLog
lisp/rfc2047.el

index c1d4a7c..ce4a3a5 100644 (file)
@@ -1,3 +1,7 @@
+2004-11-17  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * rfc2047.el (rfc2047-encode-region): Encode bogus delimiters.
+
 2004-11-15  Jesper Harder  <harder@ifa.au.dk>
 
        * pop3.el (pop3-leave-mail-on-server): Don't quote nil in
index 53765ed..11c5377 100644 (file)
@@ -422,7 +422,9 @@ Dynamically bind `rfc2047-encoding-type' to change that."
                              ;; to be encoded so that MTAs may parse
                              ;; them safely.
                              (cond ((= end (point)))
-                                   ((looking-at encodable-regexp)
+                                   ((looking-at (concat "\\sw*\\("
+                                                        encodable-regexp
+                                                        "\\)"))
                                     (setq end nil))
                                    (t
                                     (goto-char (1- (match-end 0)))
@@ -442,12 +444,20 @@ Dynamically bind `rfc2047-encoding-type' to change that."
                  (goto-char start)
                  (if (re-search-forward encodable-regexp end 'move)
                      (progn
-                       (goto-char start)
-                       (unless (memq (char-before) '(nil ?\t ? ))
-                         ;; Separate encodable text and delimiter.
-                         (insert " ")
-                         (setq end (1+ end)))
-                       (rfc2047-encode (point) end)
+                       (unless (memq (char-before start) '(nil ?\t ? ))
+                         (if (progn
+                               (goto-char start)
+                               (skip-chars-backward "^ \t\n")
+                               (and (looking-at "\\Sw+")
+                                    (= (match-end 0) start)))
+                             ;; Also encode bogus delimiters.
+                             (setq start (point))
+                           ;; Separate encodable text and delimiter.
+                           (goto-char start)
+                           (insert " ")
+                           (setq start (1+ start)
+                                 end (1+ end))))
+                       (rfc2047-encode start end)
                        (setq last-encoded t))
                    (setq last-encoded nil)))))
            (error