*** Backends/CLX/image.lisp.orig	Thu Feb  3 21:49:21 2005
--- Backends/CLX/image.lisp	Thu Feb  3 19:32:24 2005
***************
*** 108,114 ****
    `(the (unsigned-byte 8) (logand ,pixel 255)))
  
  (defmethod write-pnm ((image truecolor-image) filename output-format)
!   (with-open-file (stream filename :direction :output :if-exists :supersede)
        (if (eq output-format :ascii)
  	  (write-ppm-p3 stream (image-pixels image))
  	(write-ppm-p6 stream (image-pixels image)))))
--- 108,115 ----
    `(the (unsigned-byte 8) (logand ,pixel 255)))
  
  (defmethod write-pnm ((image truecolor-image) filename output-format)
!   (with-open-file (stream filename :direction :output :if-exists :supersede
!                    #+SB-UNICODE :external-format #+SB-UNICODE :latin-1)
        (if (eq output-format :ascii)
  	  (write-ppm-p3 stream (image-pixels image))
  	(write-ppm-p6 stream (image-pixels image)))))
***************
*** 149,155 ****
    0)
  
  (defmethod write-pnm ((image 256-gray-level-image) filename output-format)
!   (with-open-file (stream filename :direction :output :if-exists :supersede)
        (if (eq output-format :ascii)
  	  (write-pgm-p2 stream (image-pixels image))
  	(write-pgm-p5 stream (image-pixels image)))))
--- 150,157 ----
    0)
  
  (defmethod write-pnm ((image 256-gray-level-image) filename output-format)
!   (with-open-file (stream filename :direction :output :if-exists :supersede
!                    #+SB-UNICODE :external-format #+SB-UNICODE :latin-1)
        (if (eq output-format :ascii)
  	  (write-pgm-p2 stream (image-pixels image))
  	(write-pgm-p5 stream (image-pixels image)))))
***************
*** 167,173 ****
    (make-instance 'binary-image :pixels pixels))
  
  (defmethod write-pnm ((image binary-image) filename output-format)
!   (with-open-file (stream filename :direction :output :if-exists :supersede)
        (if (eq output-format :ascii)
  	  (write-pbm-p1 stream (image-pixels image))
  	(write-pbm-p4 stream (image-pixels image)))))
--- 169,176 ----
    (make-instance 'binary-image :pixels pixels))
  
  (defmethod write-pnm ((image binary-image) filename output-format)
!   (with-open-file (stream filename :direction :output :if-exists :supersede
!                    #+SB-UNICODE :external-format #+SB-UNICODE :latin-1)
        (if (eq output-format :ascii)
  	  (write-pbm-p1 stream (image-pixels image))
  	(write-pbm-p4 stream (image-pixels image)))))
***************
*** 350,356 ****
  	  finally (return result))))
  
  (defun read-pnm-file (filename)
!   (with-open-file (stream filename :direction :input :element-type '(unsigned-byte 8))
      (let ((byte1 (read-byte stream)))
        (cond ((= byte1 (char-code #\P))
  	     ;; probably a PNM file
--- 353,361 ----
  	  finally (return result))))
  
  (defun read-pnm-file (filename)
!   (with-open-file (stream filename :direction :input
!                    :element-type '(unsigned-byte 8)
!                    #+SB-UNICODE :external-format #+SB-UNICODE :latin-1)
      (let ((byte1 (read-byte stream)))
        (cond ((= byte1 (char-code #\P))
  	     ;; probably a PNM file
