Re: User-specified encoding for postgresql-socket [Was CCL postgresql-socket with UTF-8]
Nathan Bird <[email protected]> Mon, 20 Jun 2011 11:35:11 -0400
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <[email protected]> |
On 06/12/2011 12:00 PM, Kevin Rosenberg wrote: > Otto Diesenbacher wrote: >> so - here is a patch against postgresql-socket-api.lisp to have UTF-8 >> support with CCL (tested withh CCL64/Linux and CCL32/Windows) and >> postgresql-socket (against clsql-20110522-git, current quicklisp-dist). > Thanks for the patch, it's a good patch, and I/m releasing CLSQL 4.3.3 > with your patch. > > There's a better solution that should take someone just a few hours to > implement. Here's what I added to postgresql-socket-api.lisp. Patches > gratefully accepted :) > > ;; FIXME: The file has code specific to sb-unicode and CCL > ;; to assume UTF8 encoded strings. > ;; Best fix would be to use the user-specified encoding that is now > ;; stored in the database object and use the UFFI 2.x encoding functions > ;; to convert strings to/from octet vectors. This allows encoding > ;; other than UTF8 and also works on all CL implementations that > ;; support wide character strings Still don't have the better implementation you outlined above but that patch broke non-CCL lisps slightly. CCL doesn't support a null terminated write, so it needs to write an extra 0 byte. That should have been limited to CCL as the other codepath is already taking care of tis. Fixed this by adding a ccl conditional before the write-byte call. Patch available at: git pull git://github.com/UnwashedMeme/clsql.git master