Skip to content
Snippets Groups Projects
Commit 63f8dacf authored by emertens's avatar emertens
Browse files

Codec/Binary/UTF8/String: encodeString, decodeString

darcs-hash:20070712003740-7e720-8272766d982826a9294574c5be130f1fc9f2895f.gz
parent 3ca7ebf2
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,8 @@
module Codec.Binary.UTF8.String (
encode
, decode
, encodeString
, decodeString
) where
import Data.Word (Word8)
......@@ -22,6 +24,16 @@ import Data.Char (chr,ord)
default(Int)
-- | Encode a string using 'encode' and store the result in a 'String'.
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
-- | has been loaded into a 'String' prior to being decoded.
decodeString :: String -> String
decodeString xs = decode (map (toEnum . fromEnum) xs)
replacement_character :: Char
replacement_character = '\xfffd'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment