filepath-2.0.0.0: Library for manipulating FilePaths in a cross platform way.
Safe HaskellNone
LanguageHaskell2010

System.AbstractFilePath.Data.ByteString.Short.Decode

Synopsis

Documentation

decodeUtf16LE :: ShortByteString -> String Source #

Decode text from little endian UTF-16 encoding.

If the input contains any invalid little endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use decodeUtf16LEWith.

decodeUtf16LEWith :: OnDecodeError -> ShortByteString -> String Source #

Decode text from little endian UTF-16 encoding.

decodeUtf16LE' :: ShortByteString -> Either UnicodeException String Source #

Decode a ShortByteString containing UTF-16 encoded text.

If the input contains any invalid UTF-16 data, the relevant exception will be returned, otherwise the decoded text.

decodeUtf16LE'' :: ByteString -> Either UnicodeException String Source #

Decode a ByteString containing UTF-16 encoded text.

If the input contains any invalid UTF-16 data, the relevant exception will be returned, otherwise the decoded text.

decodeUtf8 :: ShortByteString -> String Source #

Decode text from little endian UTF-16 encoding.

If the input contains any invalid little endian UTF-16 data, an exception will be thrown. For more control over the handling of invalid data, use decodeUtf16LEWith.

decodeUtf8With :: OnDecodeError -> ShortByteString -> String Source #

Decode text from little endian UTF-16 encoding.

decodeUtf8' :: ShortByteString -> Either UnicodeException String Source #

Decode a ShortByteString containing UTF-8 encoded text.

If the input contains any invalid UTF-8 data, the relevant exception will be returned, otherwise the decoded text.

strictDecode :: OnDecodeError Source #

Throw a UnicodeException if decoding fails.

lenientDecode :: OnDecodeError Source #

Replace an invalid input byte with the Unicode replacement character U+FFFD.

type OnError a b = String -> Maybe a -> Maybe b Source #

data UnicodeException Source #

An exception type for representing Unicode encoding errors.

Constructors

DecodeError String (Maybe Word8)

Could not decode a byte sequence because it was invalid under the given encoding, or ran out of input in mid-decode.