> "Incorrect" UTF-8 in Chars is seen only by the conversion engine and
> sometimes by low-level I/O code.

... and by the application if it inadvertently specifies "no encoding" when
the source is actually encoded.

I think I agree with John here - specifying "no encoding" on a Handle
shouldn't yield text (i.e. [Char]), it should give you a handle on which you
can only read/write Word8, or something similar.

Implementation-wise, specifying ISO8859 as the encoding is functionally
equivalent to no-encoding, so the byte stream functions could be implemented
as wrappers around the handle functions using ISO8859 as the encoding.

So: a handle would either be no-encoding, in which case you can use hGetByte
and friends, or it would have an encoding in which case you can use hGetChar
and friends.  Perhaps this is too much complication given that the
underlying implementations are so similar, but it seems nice.

Cheers,
        Simon

Reply via email to