Update of /project/pg/cvsroot/pg In directory common-lisp.net:/tmp/cvs-serv24597
Modified Files: sysdep.lisp Log Message: possible sbcl unicode fix Date: Wed May 4 22:51:36 2005 Author: pvaneynde
Index: pg/sysdep.lisp diff -u pg/sysdep.lisp:1.6 pg/sysdep.lisp:1.7 --- pg/sysdep.lisp:1.6 Wed Aug 11 15:27:48 2004 +++ pg/sysdep.lisp Wed May 4 22:51:35 2005 @@ -306,6 +306,15 @@
(defvar *pg-client-encoding*)
+#+(and :sbcl :sb-unicode) +(defun sbcl-ext-form-from-client-encoding (encoding) + (cond + ((string= encoding "SQL_ASCII") :ascii) + ((string= encoding "LATIN1") :latin1) + ((string= encoding "LATIN9") :latin9) + ((string= encoding "UNICODE") :utf8) + (t (error "unkown encoding ~A" encoding)))) + (defun convert-string-to-bytes (string &optional (encoding *pg-client-encoding*)) (declare (type string string)) (%sysdep "convert string to bytes" @@ -313,6 +322,8 @@ (ext:convert-string-to-bytes string encoding) #+(and acl ics) (excl:string-to-octets string :external-format encoding) + #+(and :sbcl :sb-unicode) + (sb-ext:string-to-octets string :external-format (sbcl-ext-form-from-client-encoding encoding)) #+(or cmu sbcl gcl ecl) (let ((octets (make-array (length string) :element-type '(unsigned-byte 8)))) (map-into octets #'char-code string)))) @@ -324,10 +335,12 @@ (ext:convert-string-from-bytes bytes encoding) #+(and acl ics) (ext:octets-to-string bytes :external-format encoding) + #+(and :sbcl :sb-unicode) + (sb-ext:octets-to-string bytes :external-format encoding) ;; for implementations that have no support for character ;; encoding, we assume that the encoding is an octet-for-octet ;; encoding, and convert directly - #+(or cmu sbcl gcl ecl) + #+(or cmu (and sbcl (not :sb-unicode)) gcl ecl) (let ((string (make-string (length bytes)))) (map-into string #'code-char bytes))))