diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-06-10 16:05:56 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-06-10 16:05:56 +0200 |
commit | d1e78d96b6ad9a4afe4b319f9c06668e0aa4ca1c (patch) | |
tree | 5226f9b26ebb7b5c045d5add6022301f56b4b1a5 /src/Text/Pandoc | |
parent | 627e27fc1e3800e71cac0d0b0ae7f1e687772aea (diff) | |
download | pandoc-d1e78d96b6ad9a4afe4b319f9c06668e0aa4ca1c.tar.gz |
UTF8: export fromText, fromTextLazy.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/UTF8.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/UTF8.hs b/src/Text/Pandoc/UTF8.hs index 3f1b28e54..663f30d92 100644 --- a/src/Text/Pandoc/UTF8.hs +++ b/src/Text/Pandoc/UTF8.hs @@ -44,7 +44,9 @@ module Text.Pandoc.UTF8 ( readFile , toString , toText , fromString + , fromText , toStringLazy + , fromTextLazy , toTextLazy , fromStringLazy , encodePath @@ -143,11 +145,17 @@ toTextLazy = TL.decodeUtf8 . filterCRs . dropBOM toStringLazy :: BL.ByteString -> String toStringLazy = TL.unpack . toTextLazy +fromText :: T.Text -> B.ByteString +fromText = T.encodeUtf8 + +fromTextLazy :: TL.Text -> BL.ByteString +fromTextLazy = TL.encodeUtf8 + fromString :: String -> B.ByteString -fromString = T.encodeUtf8 . T.pack +fromString = fromText . T.pack fromStringLazy :: String -> BL.ByteString -fromStringLazy = TL.encodeUtf8 . TL.pack +fromStringLazy = fromTextLazy . TL.pack encodePath :: FilePath -> FilePath encodePath = id |