summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/UTF8.hs12
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