text-0.8.1.0: An efficient packed Unicode text type.

Portabilityportable
Stabilityexperimental
Maintainerbos@serpentine.com, rtomharper@googlemail.com, duncan@haskell.org

Data.Text.Lazy.Encoding

Contents

Description

Functions for converting lazy Text values to and from lazy ByteString, using several standard encodings.

To make use of a much larger variety of encodings, use the text-icu package.

Synopsis

Decoding ByteStrings to Text

decodeASCII :: ByteString -> TextSource

Decode a ByteString containing 7-bit ASCII encoded text.

decodeUtf8 :: ByteString -> TextSource

Decode a ByteString containing UTF-8 encoded text.

decodeUtf16LE :: ByteString -> TextSource

Decode text from little endian UTF-16 encoding.

decodeUtf16BE :: ByteString -> TextSource

Decode text from big endian UTF-16 encoding.

decodeUtf32LE :: ByteString -> TextSource

Decode text from little endian UTF-32 encoding.

decodeUtf32BE :: ByteString -> TextSource

Decode text from big endian UTF-32 encoding.

Controllable error handling

decodeUtf8With :: OnDecodeError -> ByteString -> TextSource

Decode a ByteString containing UTF-8 encoded text.

decodeUtf16LEWith :: OnDecodeError -> ByteString -> TextSource

Decode text from little endian UTF-16 encoding.

decodeUtf16BEWith :: OnDecodeError -> ByteString -> TextSource

Decode text from big endian UTF-16 encoding.

decodeUtf32LEWith :: OnDecodeError -> ByteString -> TextSource

Decode text from little endian UTF-32 encoding.

decodeUtf32BEWith :: OnDecodeError -> ByteString -> TextSource

Decode text from big endian UTF-32 encoding.

Encoding Text to ByteStrings

encodeUtf8 :: Text -> ByteStringSource

Encode text using UTF-8 encoding.

encodeUtf16LE :: Text -> ByteStringSource

Encode text using little endian UTF-16 encoding.

encodeUtf16BE :: Text -> ByteStringSource

Encode text using big endian UTF-16 encoding.

encodeUtf32LE :: Text -> ByteStringSource

Encode text using little endian UTF-32 encoding.

encodeUtf32BE :: Text -> ByteStringSource

Encode text using big endian UTF-32 encoding.