Data.Bytes.Text.Utf8
Description
Convert Bytes to and from Text and ShortText.
Bytes
Text
ShortText
fromShortText :: ShortText -> Bytes Source #
Encode ShortText using UTF-8. Since ShortText is backed by a UTF-8 byte sequence, this does not perform a copy.
toShortText :: Bytes -> Maybe ShortText Source #
Attempt to interpret the byte sequence as UTF-8 encoded text. Returns Nothing if the bytes are not UTF-8 encoded text.
Nothing
fromText :: Text -> Bytes Source #
Encode Text using UTF-8. Only available when building with text-2.0 and newer. Since Text is backed by a UTF-8 byte sequence, this does not perform a copy.
UTF-8
text-2.0