[plt-dev] pgsql package

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Wed Jul 29 20:37:56 EDT 2009

Dave Gurnell wrote:
> Robby wrote:
>> Hi all (Ryan?): I've got a question about pgsql. From what I can tell,
>> string data is stored in the database in the latin-1 encoding
>> (sql-data.ss line 191), but is then retrieved from the database in the
>> utf-8 encoding (io.ss line 205). Am I getting that right?
>> This doesn't mean much, but I changed planet's copy of io.ss to use
>> bytes->string/latin-1 instead of bytes->string/utf-8, and I was able
>> to avoid crashing (but the latin-1 encoding might not have any
>> unencodable octets, so that isn't really saying too too much).
> PostgreSQL lets you specify character encodings on a per-database and 
> per-client basis. The shell command:
>   psql -l
> will show you your setting for each database on your server. The psql 
> command:
>    \encoding
> will show you your client encoding for your current session. You can set 
> your client encoding using the psql command:
>     \encoding UTF8
> I'm guessing backslash commands can also be sent over an SPGSQL 
> connection... you could try doing:
>     (send conn exec "\\encoding UTF8")

That doesn't work. Backslash commands are handled by psql, not by the 

On the other hand, this works:
   (send conn query-value "show client_encoding")

> as soon as you connect. If that works, perhaps it's something that could 
> be rolled into SPGSQL's "connect" procedure?

'connect' requests UTF8 communication already.


> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-dev

Posted on the dev mailing list.