Re: Encoding problems

Nicolas Neuss <[email protected]>
Newsgroups gmane.lisp.clsql.general
Organization KIT Karlsruhe
Message-ID <[email protected]>
Nicolas Neuss <[email protected]> writes:

> Hello,
>
> I have a database in LATIN1 encoding:
>
> neuss@tell:~$ psql -l
>                                        List of databases
>    Name    |  Owner   | Encoding |    Collation     |      Ctype       |   Access privileges   
> -----------+----------+----------+------------------+------------------+-----------------------
>  courses   | neuss    | LATIN1   | de_DE.iso-8859-1 | de_DE.iso-8859-1 | 
>
>
> Accessing it with CLSQL I observe
>
> * It works with the :postgresql db type, however this interface is
>   somewhat unstable (SBCL drops in ldb at some place), and the reason
>   that it works is that CFFI:*DEFAULT-FOREIGN-ENCODING* is :utf-8.
>
>   (with-database-connection
>     (lname (first (select 'student :where [= [id] 713479] :flatp t))))
>   => "Böhme"
>
> * It does not work with :postgresql-socket db type (because I have
>   set SB-IMPL::*DEFAULT-EXTERNAL-FORMAT* to :latin-1)
>
>   (with-database-connection
>     (lname (first (select 'student :where [= [id] 713479] :flatp t))))
>   => "Böhme"
>
> * It works setting SB-IMPL::*DEFAULT-EXTERNAL-FORMAT* to :utf-8
>   (let ((SB-IMPL::*DEFAULT-EXTERNAL-FORMAT* :utf-8))
>     (with-database-connection
>       (lname (first (select 'student :where [= [id] 713479] :flatp t)))))
>   => "Böhme"
>
> So: Why is my database accessed with UTF-8 encoding?  And how can I
> change this?  [I would like to stay with LATIN1 external format, because
> my web pages (served by Hunchentoot) are in that encoding.]
>
> Thank you,
> Nicolas

[Strangely, this message arrived here only now - more than one week
later.]

In the meantime I have solved my problem, and it turned out to be an
error of myself.  Indeed, the UTF-sequences had been written to the
LATIN-1 database, probably because up to now I have never cared about
the (default) CFFI encoding :utf-16 when I worked with it.

Nicolas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.