release.
[elisp/flim.git] / eword-decode.el
index 328cc28..311e080 100644 (file)
@@ -1,6 +1,6 @@
 ;;; eword-decode.el --- RFC 2047 based encoded-word decoder for GNU Emacs
 
-;; Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
+;; Copyright (C) 1995,96,97,98,99,2000,01,03,04 Free Software Foundation, Inc.
 
 ;; Author: ENAMI Tsugutomo <enami@sys.ptg.sony.co.jp>
 ;;         MORIOKA Tomohiko <tomo@m17n.org>
@@ -578,13 +578,15 @@ as a version of Net$cape)."
       (when dest
        (setq dest (decode-mime-charset-string dest charset))
        (when must-unfold
-         (mapconcat
-          (function
-           (lambda (chr)
-             (cond ((eq chr ?\n) "")
-                   ((eq chr ?\t) " ")
-                   (t (char-to-string chr)))))
-          (std11-unfold-string dest) ""))
+         (setq dest
+               (mapconcat
+                (function
+                 (lambda (chr)
+                   (cond ((eq chr ?\n) "")
+                         ((eq chr ?\r) "")
+                         ((eq chr ?\t) " ")
+                         (t (char-to-string chr)))))
+                (std11-unfold-string dest) "")))
        (when language
          (put-text-property 0 (length dest) 'mime-language language dest))
        dest))))
@@ -621,16 +623,17 @@ returns nil, next function is used.  Otherwise the return value will
 be the result.")
 
 (defun eword-analyze-quoted-string (string start &optional must-unfold)
-  (let ((p (std11-check-enclosure string ?\" ?\" nil start)))
-    (if p
-       (cons (cons 'quoted-string
-                   (decode-mime-charset-string
-                    (std11-strip-quoted-pair
-                     (substring string (1+ start) (1- p)))
-                    default-mime-charset))
-             ;;(substring string p))
-             p)
-      )))
+  (let ((p (std11-check-enclosure string ?\" ?\" nil start))
+       ret)
+    (when p
+      (setq ret (decode-mime-charset-string
+                (std11-strip-quoted-pair
+                 (substring string (1+ start) (1- p)))
+                default-mime-charset))
+      (if mime-header-accept-quoted-encoded-words
+         (setq ret (eword-decode-string ret)))
+      (cons (cons 'quoted-string ret)
+           p))))
 
 (defun eword-analyze-domain-literal (string start &optional must-unfold)
   (std11-analyze-domain-literal string start))