Skip to content

Commit

Permalink
Revise fileContentAsString encoding (issue #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
steindani committed May 28, 2017
1 parent 913ca87 commit 27a7ccb
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions IncludeFilter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,9 @@ stripPandoc p =
Right (Pandoc _ blocks) -> blocks

fileContentAsString :: String -> IO String
fileContentAsString file = do
let handle = openFile file ReadMode
fmap (`hSetEncoding` utf8) handle
!contents <- fmap hGetContents handle
fmap hClose handle
contents
fileContentAsString file = withFile file ReadMode $ \handle -> do
hSetEncoding handle utf8
hGetContents handle

fileContentAsBlocks :: String -> IO [Block]
fileContentAsBlocks file = do
Expand Down

0 comments on commit 27a7ccb

Please sign in to comment.