RE: Marshalling Haskell String <-> UTF-8

2004-09-02 Thread Simon Marlow
On 02 September 2004 11:36, Ross Paterson wrote: > On Wed, Sep 01, 2004 at 04:39:30PM -0700, John Meacham wrote: >> 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

Re: Marshalling Haskell String <-> UTF-8

2004-09-02 Thread Ross Paterson
On Wed, Sep 01, 2004 at 04:39:30PM -0700, John Meacham wrote: > 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 qu

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-

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 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 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-

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 woul

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?

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 CStri