[Openmcl-devel] Using clsql (:mysql) to retrieve Unicode strings from a database

Paul Meurer paul.meurer at uni.no
Fri Mar 25 11:02:36 PDT 2011


Hi,

you can issue a

	(execute-command "set names UTF8")

after you established your connection. That works for me, although there should be a more elegant solution.

Best,
Paul

Am 25.03.2011 um 18:23 schrieb Tom Emerson:

> Hi all,
> 
> I'm trying to use the latest CLSQL (with the MySQL backend) to retrieve rows from a database that is using UTF-8 for the VARCHAR columns.
> 
> I had hoped that specifying UTF-8 when opening the connection would be sufficient, e.g.
> 
> (clsql:connect '(nil "database" "user" "password") :database-type :mysql :encoding :utf-8)
> 
> would be sufficient, but any query that includes a UTF-8 column has the database coming back as ?s.
> 
> Has anyone had success doing this? I did try
> 
> (setf UFFI:*DEFAULT-FOREIGN-ENCODING* :utf-8)
> 
> before connecting or making the query, but that didn't help (and shouldn't be necessary regardless.)
> 
> Thanks in advance for any insight you may have.
> 
>     -tree
> 
> P.S. CCL 1.7-dev-r14672M-trunk, 64-bit build. MySQL 5.1.49. I have Python code that can retrieve data from the same database without a problem, so I know it is possible to do. I'd rather stop using Python though.
> 
> -- 
> Tom Emerson
> tremerson at gmail.com
> http://treerex.blogspot.com/
> 
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel



-- 
Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20110325/5835cab8/attachment.htm>


More information about the Openmcl-devel mailing list