Re: Migrating from UFFI to CFFI

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Wed, 16 Oct 2013 21:27:27 -0600
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
On Oct 16, 2013, at 11:07 AM, Victor <[email protected]> wrote:
> ? (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.

Your suspicion may well be right. I look a look at the code and see that
uffi::%convert-to-foreign-string for ccl stores two bytes of zeros after
storing the bytes returned by ccl:encode-string-to-octets.

On the reverse, uffi:convert-from-foreign-string uses the internal
ccl::%get-utf-8-cstring for decoding :utf-8 encoded foreign strings.

Perhaps something has changed in the internals of ccl utf-8 representation
since I wrote, tested, and committed that code in Feb 2010. If you see some
useful ideas for an update, please forward them to me and I'll be glad to 
commit a fix to work for UFFI to work with the current version of ccl.
Ideally, there may be documented, exported functions for encoding/decoding
internationalized strings in the current version of ccl.

Kevin


_______________________________________________
CLSQL mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/clsql