Hi,
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.
Thanks,
Tamas
Tamas K Papp tpapp@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.