[cxml-cvs] CVS closure-common

dlichteblau dlichteblau at common-lisp.net
Sun Feb 24 20:38:35 UTC 2008


Update of /project/cxml/cvsroot/closure-common
In directory clnet:/tmp/cvs-serv4575

Modified Files:
	xstream.lisp 
Log Message:
allow Microsoft BOM (thanks to Ivan Shvedunov)

--- /project/cxml/cvsroot/closure-common/xstream.lisp	2007/12/22 15:19:25	1.9
+++ /project/cxml/cvsroot/closure-common/xstream.lisp	2008/02/24 20:38:35	1.10
@@ -342,7 +342,6 @@
 (defun make-rod-xstream (string &key name)
   (unless (typep string 'simple-array)
     (setf string (coerce string 'simple-string)))
-  ;; XXX encoding is mis-handled by this kind of stream
   (let ((n (length string)))
     (let ((buffer (make-array (1+ n) :element-type 'buffer-byte)))
       (declare (type (simple-array buffer-byte (*)) buffer))
@@ -375,6 +374,11 @@
                    (t
                     (cond ((and (= c0 #xFE) (= c1 #xFF)) (values :utf-16-big-endian nil))
                           ((and (= c0 #xFF) (= c1 #xFE)) (values :utf-16-little-endian nil))
+                          ((and (= c0 #xEF) (= c1 #xBB))
+                           (let ((c2 (read-byte stream nil :eof)))
+                             (if (= c2 #xBF)
+                                 (values :utf-8 nil)
+                                 (values :utf-8 (list c0 c1 c2)))))
                           (t
                            (values :utf-8 (list c0 c1)))))))))))
 




More information about the Cxml-cvs mailing list