Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Codec/Binary/UTF8/String.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ import Data.Char (chr,ord)
default(Int)

-- | Encode a string using 'encode' and store the result in a 'String'.
-- | Note: prefer 'encode' over this function, as it is easy to mistakenly
-- | encode the same string more than once.
encodeString :: String -> String
encodeString xs = map (toEnum . fromEnum) (encode xs)

-- | Decode a string using 'decode' using a 'String' as input.
-- | This is not safe but it is necessary if UTF-8 encoded text
-- | Note: this is not safe but it is necessary if UTF-8 encoded text
-- | has been loaded into a 'String' prior to being decoded.
decodeString :: String -> String
decodeString xs = decode (map (toEnum . fromEnum) xs)
Expand Down