Proposal #3455: Add a setting to change how Unicode encoding
errors are handled
duncan.coutts at worc.ox.ac.uk
Sun Aug 23 20:53:29 EDT 2009
On Sun, 2009-08-23 at 09:22 -0700, Judah Jacobson wrote:
> I proposal that we augment ghc-6.12.1's support for Unicode Handles
> by adding the following functions to System.IO:
> hSetOnEncodingError :: Handle -> OnEncodingError -> IO ()
> hGetOnEncodingError :: Handle -> IO OnEncodingError
I agree that it is important.
> Note that the text package, for example, provides more sophisticated
> error-handling options. However, I think the above choices are useful
> enough without making the API too complicated.
Personally I would prefer we postpone this decision with the aim that we
unify the Text encoding / decoding between the IO system and text
Specifically I suggest we put this decision off until after ICFP where
we hope that the authors of ghc's new text IO system and the authors of
the text package can get together with other interested individuals to
discuss some more unified system.
It should be possible to make an encoder abstraction that can be used
purely in the text package for conversion between ByteString <-> Text,
and also used in the IO system for text mode Handles.
How to handle encoding and translation errors would have to be part of
the design of that encoder abstraction.
My impression is that an ST version of the current text encoder
abstraction in the GHC text IO system would also be usable for pure
conversions in the text package.
More information about the Libraries