Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides a stream-based approach to decoding Unicode data. Each function
below works the same way: you give it a chunk of data, and it gives back a
DecodeResult
. If the parse was a success, then you get a chunk of Text
(possibly empty) and a continuation parsing function. If the parse was a
failure, you get a chunk of successfully decoded Text
(possibly empty) and
the unconsumed bytes.
In order to indicate end of stream, you pass an empty ByteString
to the
decode function. This call may result in a failure, if there were unused
bytes left over from a previous step which formed part of a code sequence.
Synopsis
Streaming
decodeUtf8 :: ByteString -> DecodeResult Source #
O(n) Convert a ByteString
into a 'Stream Char', using
UTF-8 encoding.
decodeUtf8Pure :: ByteString -> DecodeResult Source #
O(n) Convert a ByteString
into a 'Stream Char', using
UTF-8 encoding.
decodeUtf16LE :: ByteString -> DecodeResult Source #
O(n) Convert a ByteString
into a 'Stream Char', using little
endian UTF-16 encoding.
decodeUtf16BE :: ByteString -> DecodeResult Source #
O(n) Convert a ByteString
into a 'Stream Char', using big
endian UTF-16 encoding.
decodeUtf32LE :: ByteString -> DecodeResult Source #
O(n) Convert a ByteString
into a 'Stream Char', using little
endian UTF-32 encoding.
decodeUtf32BE :: ByteString -> DecodeResult Source #
O(n) Convert a ByteString
into a 'Stream Char', using big
endian UTF-32 encoding.