ANN: H98 FFI Addendum 1.0, Release Candidate 13

Manuel M T Chakravarty chak at cse.unsw.edu.au
Sun Nov 2 05:37:38 EST 2003


John Meacham <john at repetae.net> wrote,

> On Fri, Oct 31, 2003 at 12:32:55PM +0000, Ross Paterson wrote:
> > Making the Right Thing the default, though it may cost more, seems
> > appropriate.
> > 
> > In the sentence
> > 
> > 	The marshalling takes the current Unicode encoding on the
> > 	Haskell side into account.
> > 
> > (which seems to have been there before), "current" seems wrong, since
> > the Haskell side is constant.  How about something like
> > 
> > 	The marshalling converts each Haskell character, representing
> > 	a Unicode code point, to one or more bytes in a manner
> > 	determined by the current locale.
> > 
> > and dropping the later sentence about the locale.
> 
> This sounds good to me. I also might reword the paragraph introducing
> the 8bit versions, as the efficiency reason for using them is less
> important than the API one. meaning that some C APIs specify that a
> localized string should be passed, while others explicitly don't use
> localization and only expect ASCII (or another specific encoding such as
> utf8) strings and this is most likely what will determine the choice of
> string marshalers. 

True.  I changed that.

> > What happens if one attempts to convert a Char that has no encoding
> > in the current locale?
> 
> my implementation converts unrepresentable characters to '?'. But
> a case could be made for throwing a CharsetConversion exception of some
> sort or simply eliding invalid characters. I am not sure what is best, I
> chose the '?' route because it matches what happens when you don't have
> a font installed and get a replacement character and is less troublesome
> for the user.  

I agree.  I now documented to conversion to '?'.

Cheers,
Manuel


More information about the FFI mailing list