Merge from gnus--rel--5.10
[gnus] / lisp / uudecode.el
index 0e9ac10..bd277d8 100644 (file)
@@ -1,7 +1,7 @@
 ;;; uudecode.el -- elisp native uudecode
 
-;; Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004
-;;        Free Software Foundation, Inc.
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 ;; Keywords: uudecode news
@@ -20,8 +20,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -50,7 +50,7 @@ input and write the converted data to its standard output."
 (defcustom uudecode-use-external
   (executable-find uudecode-decoder-program)
   "*Use external uudecode program."
-  :version "21.4"
+  :version "22.1"
   :group 'gnus-extract
   :type 'boolean)
 
@@ -98,7 +98,11 @@ used is specified by `uudecode-decoder-program'."
                              (make-temp-name "uu")
                              uudecode-temporary-file-directory))))
        (let ((cdir default-directory)
-             default-process-coding-system)
+             (default-process-coding-system
+               (if (featurep 'xemacs)
+                   ;; In XEmacs, `nil' is not a valid coding system.
+                   '(binary . binary)
+                 nil)))
          (unwind-protect
              (with-temp-buffer
                (insert "begin 600 " (file-name-nondirectory tempfile) "\n")
@@ -199,7 +203,10 @@ If FILE-NAME is non-nil, save the result to FILE-NAME."
                (insert (apply 'concat (nreverse result)))))
          (or (markerp end) (setq end (set-marker (make-marker) end)))
          (goto-char start)
-         (insert (apply 'concat (nreverse result)))
+         (if enable-multibyte-characters
+             (mapc #'(lambda (x) (insert (string-to-multibyte x)))
+                   (nreverse result))
+           (insert (apply 'concat (nreverse result))))
          (delete-region (point) end))))))
 
 ;;;###autoload