portable encoding/decoding without going via a handle

Ganesh Sittampalam ganesh at earth.li
Sat Nov 24 23:00:49 CET 2012


Hi,

I need to convert directly between different string encodings, rather
than just using a particular encoding when reading from/writing to a Handle.

I'm aware of the following options, but they have a few problems:

- text-icu: not easily usable on Windows as it requires libicu
- text: just handles utf8/16/32
- iconv: POSIX only

It seems like GHC's TextEncoding has the necessary low-level
functionality
(http://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-IO-Encoding-Types.html#t:BufferCodec),
but I can't find any high-level interface for directly transcoding
between String/Bytestring/Text.

Am I missing something, or would this be a useful addition as a separate
library?

Cheers,

Ganesh



More information about the Libraries mailing list