Marshalling Haskell String <-> UTF-8
David Roundy
droundy at abridgegame.org
Wed Sep 1 06:26:45 EDT 2004
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
>
> http://www.haskell.org/pipermail/ffi/2003-August/001355.html
You could also look at the darcs source code, as darcs uses UTF8 to store
file names.
--
David Roundy
http://www.abridgegame.org/darcs
More information about the Glasgow-haskell-users
mailing list