@@ -53,7 +53,9 @@ import Data.List (intercalate, isPrefixOf, isSuffixOf, sort)
5353import qualified Data.Map as M
5454import Data.Maybe (fromMaybe, isJust, isNothing)
5555import qualified Data.Set as Set
56+import Data.Text (Text)
5657import qualified Data.Text as T
58+import qualified Data.Text.IO as T
5759import Data.Yaml (decode)
5860import qualified Data.Yaml as Yaml
5961import GHC.Generics
@@ -381,8 +383,8 @@ convertWithOpts opts = do
381383 then 0
382384 else optTabStop opts)
383385
384− readSources :: [FilePath] -> PandocIO String
385− readSources srcs = convertTabs . intercalate "\n" <$>
386+ readSources :: [FilePath] -> PandocIO Text
387+ readSources srcs = convertTabs . T.intercalate (T.pack "\n") <$>
386388 mapM readSource srcs
387389
388390 let runIO' :: PandocIO a -> IO a
@@ -405,9 +407,9 @@ convertWithOpts opts = do
405407 case reader of
406408 StringReader r
407409 | optFileScope opts || readerName == "json" ->
408− mconcat <$> mapM (readSource >=> r readerOpts) sources
410+ mconcat <$> mapM (readSource >=> r readerOpts . T.unpack) sources
409411 | otherwise ->
410− readSources sources' >>= r readerOpts
412+ readSources sources' >>= r readerOpts . T.unpack
411413 ByteStringReader r ->
412414 mconcat <$> mapM (readFile' >=> r readerOpts) sources
413415
@@ -782,21 +784,23 @@ applyFilters mbDatadir filters args d = do
782784 expandedFilters <- mapM (expandFilterPath mbDatadir) filters
783785 foldrM ($) d $ map (flip externalFilter args) expandedFilters
784786
785−readSource :: FilePath -> PandocIO String
786−readSource "-" = liftIO UTF8.getContents
787+readSource :: FilePath -> PandocIO Text
788+readSource "-" = liftIO T.getContents
787789readSource src = case parseURI src of
788790 Just u | uriScheme u `elem` ["http:","https:"] ->
789791 readURI src
790792 | uriScheme u == "file:" ->
791− liftIO $ UTF8.readFile (uriPath u)
792− _ -> liftIO $ UTF8.readFile src
793+ liftIO $ UTF8.toText <$>
794+ BS.readFile (uriPath u)
795+ _ -> liftIO $ UTF8.toText <$>
796+ BS.readFile src
793797
794−readURI :: FilePath -> PandocIO String
798+readURI :: FilePath -> PandocIO Text
795799readURI src = do
796800 res <- liftIO $ openURL src
797801 case res of
798802 Left e -> throwError $ PandocHttpError src e
799− Right (contents, _) -> return $ UTF8.toString contents
803+ Right (contents, _) -> return $ UTF8.toText contents
800804
801805readFile' :: MonadIO m => FilePath -> m B.ByteString
802806readFile' "-" = liftIO B.getContents