Re: Migrating from UFFI to CFFI

Ralf Mattes <rm-OuoMP45H64u6ogTlOYt/[email protected]> Wed, 16 Oct 2013 20:06:27 +0200
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
On Wed, Oct 16, 2013 at 08:07:00PM +0300, Victor wrote:
> On Thu, 10 Oct 2013 11:51:20 +0300, Victor <[email protected]> wrote:
> .....
> > The second problem is that on ClozureCL v1.9 CLSQL-SQLITE3 corrupts
> > unicode strings when they are read and stored to the database.
> >
> > Setting uffi:*default-foreign-encoding* to :utf-8 solves the "read"
> > part but strings are still corrupted when stored to the database.
> 
> 
> Hi,
> 
> the problem is relatively easy to reproduce:
> 
> (uffi:convert-from-foreign-string (uffi:convert-to-foreign-string "abc"))
> "abc"
> ? (uffi:convert-from-foreign-string (uffi:convert-to-foreign-string "??????"))
> "^Z^Z^Z"
> 
> I suspect that the problem is in the uffi:convert-to-foreign-string function.
> 
> I've asked this question on the openmcl-devel mailing list:
> 
> http://clozure.com/pipermail/openmcl-devel/2013-October/014572.html
> 
> hope that this problem will be fixed.

Just send this to this ML as well.

>From the what you describe it really looks as if you're working from a terminal
and forgot to set Clozure's terminal encoding.
Try starting your lisp like this:

  ./lx86cl64 -K "utf-8"

If your problems show up in scripts I'd check whether the source really is utf-8 encoded
(Emacs will help you with this).

 HTH Ralf Mattes