Synch to No Gnus 200602081205.
[elisp/gnus.git-] / lisp / rfc2047.el
index 3ce10e5..ef2ff11 100644 (file)
@@ -1,7 +1,7 @@
 ;;; rfc2047.el --- functions for encoding and decoding rfc2047 messages
 
 ;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;;   2005, 2006 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
@@ -802,11 +802,11 @@ If your Emacs implementation can't decode CHARSET, return nil."
            (memq 'gnus-all mail-parse-ignored-charsets)
            (memq charset mail-parse-ignored-charsets))
     (setq charset mail-parse-charset))
-  (let ((cs (mm-coding-system-p (mm-charset-to-coding-system charset))))
+  (let ((cs (mm-charset-to-coding-system charset)))
     (cond ((eq cs 'ascii)
           (setq cs (or (mm-charset-to-coding-system mail-parse-charset)
                        'raw-text)))
-         (cs)
+         ((setq cs (mm-coding-system-p cs)))
          ((and charset
                (listp mail-parse-ignored-charsets)
                (memq 'gnus-unknown mail-parse-ignored-charsets))
@@ -834,7 +834,7 @@ ENCODED-WORD)."
                         ((char-equal ?Q (nth 1 word))
                          (setq text (quoted-printable-decode-string
                                      (mm-subst-char-in-string
-                                      ?_ ? (nth 2 word) t)))))
+                                      ?_ ?  (nth 2 word) t)))))
                 (error
                  (message "%s" (error-message-string code))
                  nil)))
@@ -845,7 +845,6 @@ ENCODED-WORD)."
            (push (cons cs text) rest))
        ;; Don't decode encoded-word.
        (push (cons nil (nth 3 word)) rest)))
-    (setq words "")
     (while rest
       (setq words (concat
                   (or (and (setq cs (caar rest))
@@ -856,7 +855,9 @@ ENCODED-WORD)."
                               nil)))
                       (concat (when (cdr rest) " ")
                               (cdar rest)
-                              (unless (string-equal words "") " ")))
+                              (when (and words
+                                         (not (eq (string-to-char words) ? )))
+                                " ")))
                   words)
            rest (cdr rest)))
     words))