
On Wed, Sep 01, 2004 at 11:13:23AM +0100, Ross Paterson wrote:
On Wed, Sep 01, 2004 at 10:16:23AM +0100, Bayley, Alistair wrote:
I want to call a foreign C function that takes a UTF-8 encoded string as one of its arguments (and there's also a version of the function that receives UTF-16). Can someone point me to documentation or examples of how this would be done? AFAICT (reading the FFI spec) marshalling a String to a CString is locale-dependent, whereas I know that I want UTF-8/16.
The locale-dependent marshalling of CString described by the FFI spec isn't yet implemented in the library. There is some code by John Meacham including UTF-8 conversion at
I should mention I have a new version of the CWString library in development that conforms to the new FFI spec and works on all posixy systems, not just those that have unicode wchar_t's like my first posting. It is not quite ready for release, but if there is a strong need I can package it up nicely. John -- John Meacham - ⑆repetae.net⑆john⑈