[Haskell-cafe] invalid character encoding

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Mar 16 19:05:43 EST 2005


John Meacham <john at repetae.net> writes:

> In any case, we need tools to be able to conform to the common cases
> of ascii-only (withCAStrirg) and current locale (withCString).
>
> withUTF8String would be a nice addition, but is much less important to
> come standard as it can easily be written by end users, unlike locale
> specific versions which are necessarily system dependent.

IMHO the encoding should be a parameter of an extended variant of
withCString (and peekCString etc.).

We need a framework for implementing encoders/decoders first.
A problem with designing the framework is that it should support
both pure Haskell conversions and C functions like iconv which work
on arrays. We must also provide a way to signal errors.

A bonus is a way to handle errors coming from another recoder without
causing it to fail completely. That way one could add a fallback for
unrepresentable characters, e.g. HTML entities or approximations with
stripped accents.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-Cafe mailing list