In postgresql-socket another location dealing with octets that wasn't using the exter...
authorNathan Bird <nathan@acceleration.net>
Tue, 14 Oct 2008 19:37:49 +0000 (15:37 -0400)
committerNathan Bird <nathan@acceleration.net>
Mon, 2 Feb 2009 19:31:28 +0000 (14:31 -0500)
db-postgresql-socket/postgresql-socket-api.lisp

index 2989d578cd3b94dbfd7a071206764b4cfd1e186a..576bd80042670ff0c50a054fa620b374d3c3ea8f 100644 (file)
@@ -19,6 +19,8 @@
 
 (in-package #:postgresql-socket)
 
+(defparameter +postgres-external-format+ :utf8)
+
 (uffi:def-enum pgsql-ftype
     ((:bytea 17)
      (:int2 21)
@@ -113,7 +115,10 @@ socket interface"
         do (write-byte code socket)
         finally (write-byte 0 socket))
   #+sb-unicode
-  (write-sequence (sb-ext:string-to-octets value :external-format :utf8 :null-terminate t) socket)
+  (write-sequence (sb-ext:string-to-octets value
+                                          :external-format +postgres-external-format+
+                                          :null-terminate t)
+                 socket)
   nil)
 
 (defun send-socket-value-limstring (socket value limit)
@@ -167,7 +172,8 @@ socket interface"
     (loop for code = (read-byte socket)
           until (zerop code)
           do (vector-push-extend code bytes))
-    (sb-ext:octets-to-string bytes)))
+    (sb-ext:octets-to-string bytes
+                            :external-format +postgres-external-format+)))
 
 
 (defmacro define-message-sender (name (&rest args) &rest clauses)
@@ -226,7 +232,7 @@ socket interface"
     (declare (type (simple-array (unsigned-byte 8) (*)) bytes))
     (read-sequence bytes stream)
     (if allow-wide
-        (sb-ext:octets-to-string bytes :external-format :utf8)
+        (sb-ext:octets-to-string bytes :external-format +postgres-external-format+)
         (map 'string #'code-char bytes))))
 
 ;;; Support for encrypted password transmission