[cffi-devel] Re: unicode

Luis Oliveira luismbo at gmail.com
Wed May 16 00:21:13 UTC 2007


Tamas K Papp <tpapp at Princeton.EDU> writes:
> What is the suggested method to pass unicode strings (const char*
> pointing to an utf8 string) to C functions in CFFI?  I am using CMUCL.

The cffi-newtypes branch at <http://common-lisp.net/~loliveira/darcs/>
contains preliminary support for encodings.  You would use the type
(:string :encoding :utf-8).

However, CMUCL does not support unicode so you'd need to convert foreign
strings to vectors of either utf-8 octets or unicode code points, or you
could use something like Closure's Runes:
<http://common-lisp.net/cgi-bin/viewcvs.cgi/cxml/runes/?root=cxml>
In either case, you could write your own string type to deal with that.

Well, and you can deal with foreign pointers but I that might not be
particularly useful.

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list