[Haskell-cafe] The Nature of Char and String

Glynn Clements glynn at gclements.plus.com
Wed Feb 2 08:01:47 EST 2005


Ben Rudiak-Gould wrote:

>  >Char in Haskell represents a Unicode character.  I don't know exactly
>  >what its size is, but it must be at least 16 bits and maybe more.
>  >String would then share those properties.
>  >
>  >However, usually I'm accustomed to dealing with data in 8-bit words.
>  >So I have some questions:
> 
> Char and String handling in Haskell is deeply broken.

More accurately, string I/O (meaning all OS interfaces which take or
return strings, not just reading/writing files) in Haskell is deeply
broken.

The Haskell functions accept or return Strings but interface to OS
functions which (at least on Unix) deal with arrays of bytes (char*),
and the encoding issues are essentially ignored. If you pass strings
containing anything other than ISO-8859-1, you lose.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the Haskell-Cafe mailing list