Marshalling Haskell String - UTF-8

2004-09-01 Thread Bayley, Alistair
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

RE: Marshalling Haskell String - UTF-8

2004-09-01 Thread Simon Marlow
On 01 September 2004 10:16, 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?

Re: Marshalling Haskell String - UTF-8

2004-09-01 Thread Ross Paterson
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

Re: Marshalling Haskell String - UTF-8

2004-09-01 Thread David Roundy
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).

Re: Marshalling Haskell String - UTF-8

2004-09-01 Thread George Russell
I have implemented code to do this which I think is better than John Meacham's, because it (a) handles all UTF8 sequences (up to 6 bytes); (b) checks for errors as UTF8 decoders are supposed to do; (c) lets you determine if there is an error without having to seq the entire list. Here is a link:

RE: Marshalling Haskell String - UTF-8

2004-09-01 Thread Bayley, Alistair
From: George Russell [mailto:[EMAIL PROTECTED] http://www.haskell.org//pipermail/glasgow-haskell-users/2004-April/006 564.html Thanks George, this looks useful. There are some things I want to clarify... module UTF8( toUTF8, -- :: String - String -- Converts a String

Re: Marshalling Haskell String - UTF-8

2004-09-01 Thread John Meacham
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).