[cffi-devel] unicode
![](https://secure.gravatar.com/avatar/13663028cac36d0b9ff102354f298263.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/326b108ffcc42f27628703b0c11ed239.jpg?s=120&d=mm&r=g)
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. -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/
participants (2)
-
Luis Oliveira
-
Tamas K Papp