[pg-cvs] CVS pg

emarsden emarsden at common-lisp.net
Mon Aug 28 20:08:00 UTC 2006


Update of /project/pg/cvsroot/pg
In directory clnet:/tmp/cvs-serv5987

Modified Files:
	README pg.lisp v3-protocol.lisp 
Log Message:
Fixes to client-encoding support, based on a bug report from Johan Ur
Riise <johan at riise-data.no>. Not tested very heavily (but the tests
work in UTF-8 mode with unicode-enabled SBCL and CLISP).



--- /project/pg/cvsroot/pg/README	2005/12/19 22:29:59	1.5
+++ /project/pg/cvsroot/pg/README	2006/08/28 20:08:00	1.6
@@ -1,10 +1,10 @@
 pg.lisp -- socket level interface to the PostgreSQL RDBMS for Common Lisp
 
  Author: Eric Marsden <eric.marsden at free.fr>
- Time-stamp: <2005-12-19 emarsden>
- Version: 0.22
+ Time-stamp: <2006-08-28 emarsden>
+ Version: 0.23
 
-     Copyright (C) 1999,2000,2001,2002,2003,2004,2005  Eric Marsden
+     Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006  Eric Marsden
 
      This library is free software; you can redistribute it and/or
      modify it under the terms of the GNU Library General Public
@@ -36,8 +36,8 @@
  The only non portable code is the use of 'socket-connect' and
  (optional) some way of accessing the Unix crypt() function.
 
- Works with CMUCL, SBCL, CLISP, OpenMCL, ACL, Lispworks, MCL and
- ArmedBear Lisp. CormanLisp has socket support but not for binary I/O.
+ Works with CMUCL, SBCL, CLISP, OpenMCL, ABCL, ACL, Lispworks, and MCL.
+ CormanLisp has socket support but not for binary I/O.
 
 
 == Entry points =======================================================
@@ -247,7 +247,7 @@
 At various times, this code has been tested or reported to work with
 
    * CMUCL 18d, 18e, 19a, 19c on Solaris/SPARC and Linux/x86
-   * SBCL 0.9.2 to 0.9.7 on Linux/x86
+   * SBCL 0.9.2 to 0.9.16 on Linux/x86
    * CLISP 2.30 on LinuxPPC and SPARC
    * OpenMCL 0.13.x and 0.14.x on LinuxPPC
    * Armed Bear Common Lisp 
--- /project/pg/cvsroot/pg/pg.lisp	2006/01/25 19:25:46	1.6
+++ /project/pg/cvsroot/pg/pg.lisp	2006/08/28 20:08:00	1.7
@@ -1,7 +1,7 @@
 ;;; pg.lisp -- socket level interface to the PostgreSQL RDBMS for Common Lisp
 ;;
 ;; Author: Eric Marsden <eric.marsden at free.fr>
-;; Time-stamp: <2005-07-17 emarsden>
+;; Time-stamp: <2006-08-28 emarsden>
 ;; Version: 0.22
 ;;
 ;;     Copyright (C) 1999,2000,2001,2002,2003,2004,2005  Eric Marsden
@@ -121,7 +121,7 @@
 (defconstant +MAX_MESSAGE_LEN+    8192)     ; libpq-fe.h
 
 (defvar *pg-client-encoding* "LATIN1"
-  "The encoding to use for text data, for example \"LATIN1\", \"UNICODE\", \"EUC_JP\".
+  "The encoding to use for text data, for example \"LATIN1\", \"UTF8\", \"EUC_JP\".
 See <http://www.postgresql.org/docs/7.3/static/multibyte.html>.")
 
 (defvar *pg-date-style* "ISO")
--- /project/pg/cvsroot/pg/v3-protocol.lisp	2005/10/18 13:07:27	1.18
+++ /project/pg/cvsroot/pg/v3-protocol.lisp	2006/08/28 20:08:00	1.19
@@ -236,7 +236,7 @@
       (let* ((end (position 0 data :start position))
              (result (unless (eql end position)
                        (make-array (- end position)
-                                   :element-type 'base-char))))
+                                   :element-type 'character))))
         (when result
           (loop :for i :from position :below end
                 :for j :from 0
@@ -274,10 +274,13 @@
     (when (< length 0)
       (error "length cannot be negative. is: ~S"
              length))
-    (let* ((octects (read-octets-from-packet packet
-					     length))
-	   (string (convert-string-from-bytes octects)))
-	string)))
+    (let* ((octets (read-octets-from-packet packet length))
+           (encoding (if (or (eql #\R (pg-packet-type packet))
+                             (eql #\E (pg-packet-type packet)))
+                         "LATIN1"
+                         *pg-client-encoding*))
+	   (string (convert-string-from-bytes octets encoding)))
+      string)))
 
 (defmethod read-octets-from-packet ((packet pg-packet) (length integer))
   (let ((result (make-array length :element-type '(unsigned-byte 8))))




More information about the Pg-cvs mailing list