Commit 0ed6da94 authored by Eric Marsden's avatar Eric Marsden

Fix for encoding support for CLISP and OpenMCL (encoding still not

working correctly).

OpenMCL fix from Risto Laakso.
parent 30b13cf8
;;; sysdep.lisp -- system-dependent parts of pg-dot-lisp
;;;
;;; Author: Eric Marsden <eric.marsden@free.fr>
;;; Time-stamp: <2005-12-09 emarsden>
;;; Time-stamp: <2006-01-27 emarsden>
;;
;;
......@@ -327,27 +327,25 @@
(defun implementation-name-for-encoding (encoding)
(%sysdep "client encoding to external format name"
#+(and clisp unicode)
(cond ((string= encoding "SQL_ASCII") :ascii)
((string= encoding "LATIN1") :latin1)
((string= encoding "LATIN9") :latin9)
((string= encoding "UNICODE") :utf8)
(cond ((string= encoding "SQL_ASCII") charset:ascii)
((string= encoding "LATIN1") charset:iso-8859-1)
((string= encoding "LATIN9") charset:iso-8859-9)
((string= encoding "UTF8") charset:utf-8)
(t (error "unknown encoding ~A" encoding)))
#+(and allegro ics)
(cond ((string= encoding "SQL_ASCII") :ascii)
((string= encoding "LATIN1") :latin1)
((string= encoding "LATIN9") :latin9)
((string= encoding "UNICODE") :utf8)
((string= encoding "UTF8") :utf8)
(t (error "unknown encoding ~A" encoding)))
#+(and sbcl sb-unicode)
(cond ((string= encoding "SQL_ASCII") :ascii)
((string= encoding "LATIN1") :latin1)
((string= encoding "LATIN9") :latin9)
((string= encoding "UNICODE") :utf8)
((string= encoding "UTF8") :utf8)
(t (error "unknown encoding ~A" encoding)))
#+(or cmu gcl ecl abcl)
(cond ((string= encoding "SQL_ASCII") :ascii)
((string= encoding "LATIN1") :latin1)
((string= encoding "LATIN9") :latin9))))
#+(or cmu gcl ecl abcl openmcl)
nil))
(defun convert-string-to-bytes (string &optional (encoding *pg-client-encoding*))
(declare (type string string))
......@@ -360,7 +358,7 @@
#+(and :sbcl :sb-unicode)
(sb-ext:string-to-octets string
:external-format (implementation-name-for-encoding encoding))
#+(or cmu gcl ecl abcl)
#+(or cmu gcl ecl abcl openmcl)
(if (member encoding '("SQL_ASCII" "LATIN1" "LATIN9") :test #'string-equal)
(let ((octets (make-array (length string) :element-type '(unsigned-byte 8))))
(map-into octets #'char-code string))
......@@ -378,7 +376,7 @@
;; 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 (and sbcl (not :sb-unicode)) gcl ecl abcl)
#+(or cmu (and sbcl (not :sb-unicode)) gcl ecl abcl openmcl)
(let ((string (make-string (length bytes))))
(map-into string #'code-char bytes))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment