[pg-devel] Re: [pg-cvs] pg.lisp UTF8 SBCL

Eric Marsden eric.marsden at free.fr
Mon Aug 28 21:51:44 UTC 2006


>>>>> "jur" == Johan Ur Riise <johan at riise-data.no> writes:

  jur> Context: I want to use unicode for the Postgresql database.

  jur> I put "UTF8" in *pg-client-encoding* 
  jur> (setf *pg-client-encoding* "UTF8")
  jur> 
  jur> With 
  jur> (pg-connect "autotest" "autotest" :password "autotest")
  jur> I get this:
  jur> 
  jur> Illegal :UTF-8 character starting at byte position 0.
  jur> [Condition of type SB-IMPL::INVALID-UTF8-CONTINUATION-BYTE]

  indeed, the multibyte support in pg-dot-lisp was broken.   

  jur> I fooled around a little, and found that this is an R-packet
  jur> handled in #'pg-connect/v3 in the #\R and (5) case, where
  jur> "salt" is read with read-string-from-packet.
  jur> 
  jur> So I fixed the read-string-from-packet method to use conversion
  jur> from latin1 in case this was an #\R packet. Probably not the
  jur> right place to do it, but it seems to work.

  I have updated the CVS repository with a change similar to yours,
  that also uses LATIN1 for a #\E packet and fixes the problem with
  CLISP (you were causing implementation-name-for-encoding to be
  called twice). I have tested it lightly in UTF8 mode with
  unicode-enabled SBCL and with CLISP, but I am far from confident
  that all aspects of the protocol parsing really know when they
  should be doing multibyte decoding, and when they should be assuming
  a latin-1 encoding.

  Thanks for the report!
  
-- 
Eric Marsden




More information about the pg-devel mailing list