[Mew-dist 04732] encoded-word within quoted-string

Mito mit at example.com
1998年 5月 15日 (金) 15:15:30 JST


以前は、
  From: "=?ISO-2022-JP?B?GyRCJF4kJCRgGyhC?=" <foo at example.com>
こういうのは decode しなかったんじゃなかったでしょうか?

こんなかんじでどうでしょう。

--- mew-bq.el	1998/05/15 03:52:15	1.1
+++ mew-bq.el	1998/05/15 06:00:17
@@ -442,16 +442,19 @@
     (replace-match "?==?" nil t))
   ;; This is text. No quoted-string nor addr-spec.
   (goto-char (point-min))
-  (let (beg end cs-str)
-    (while (re-search-forward mew-header-decode-regex nil t)
-      (setq beg (match-beginning 0)
-	    end (match-end 0)
-	    cs-str (mew-header-decode (mew-match 1)
+  (let (beg end cs-str (re (concat "\"\\|" mew-header-decode-regex)))
+    (while (re-search-forward re nil t)
+      (if (eq (char-after (match-beginning 0)) ?\")
+	  (if (null (re-search-forward "[^\\]\"" nil t))
+	      (goto-char (match-end 0)))
+	(setq beg (match-beginning 0)
+	      end (match-end 0)
+	      cs-str (mew-header-decode (mew-match 1)
 					(mew-match 2)
 					(mew-match 3)))
-      (delete-region beg end)
-      (insert cs-str)
-      ))
+	(delete-region beg end)
+	(insert cs-str)
+	)))
   ;; Remove illegal \n.
   (goto-char (point-min))
   (while (re-search-forward "\n" (1- (point-max)) t)
@@ -488,16 +491,19 @@
     (replace-match "?==?" nil t))
   ;; No check for quoted-string nor addr-spec.
   (goto-char (point-min))
-  (let (beg end cs-str)
-    (while (re-search-forward mew-header-decode-regex nil t)
-      (setq beg (match-beginning 0)
-	    end (match-end 0)
-	    cs-str (mew-header-decode (mew-match 1)
+  (let (beg end cs-str (re (concat "\"\\|" mew-header-decode-regex)))
+    (while (re-search-forward re nil t)
+      (if (eq (char-after (match-beginning 0)) ?\")
+	  (if (re-search-forward "[^\\]\"" nil t)
+	      (goto-char (match-end 0)))
+	(setq beg (match-beginning 0)
+	      end (match-end 0)
+	      cs-str (mew-header-decode (mew-match 1)
 					(mew-match 2)
 					(mew-match 3)))
-      (delete-region beg end)
-      (insert cs-str)
-      ))
+	(delete-region beg end)
+	(insert cs-str)
+	)))
   ;; Remove illegal line delimiter.
   (goto-char (point-min))
   (while (re-search-forward "\\([^,]\\)\n" (1- (point-max)) t)
-- 
5/15 15:13頃
NECソフトウェア新潟 水戸
mailto:mit at example.com \n



Mew-dist メーリングリストの案内