From 37fa6df612c5d02acd7ff177293e2d7c4630ccb2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 11 Feb 2011 18:55:14 -0800 Subject: UTF8: Encode filenames. (This is still needed, even with recent base.) Partially resolves Issue #286 (though now there is a new markdown2pdf problem). --- src/Text/Pandoc/UTF8.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/UTF8.hs b/src/Text/Pandoc/UTF8.hs index a77f92cdc..4af155882 100644 --- a/src/Text/Pandoc/UTF8.hs +++ b/src/Text/Pandoc/UTF8.hs @@ -44,15 +44,16 @@ where import System.IO hiding (readFile, writeFile, getContents, putStr, putStrLn, hPutStr, hPutStrLn, hGetContents) import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn ) +import Codec.Binary.UTF8.String (encodeString) import qualified System.IO as IO readFile :: FilePath -> IO String readFile f = do - h <- openFile f ReadMode + h <- openFile (encodeString f) ReadMode hGetContents h writeFile :: FilePath -> String -> IO () -writeFile f s = withFile f WriteMode $ \h -> hPutStr h s +writeFile f s = withFile (encodeString f) WriteMode $ \h -> hPutStr h s getContents :: IO String getContents = hGetContents stdin -- cgit v1.2.3