UTF8: Encode filenames.

(This is still needed, even with recent base.)

Partially resolves Issue #286 (though now there is a
new markdown2pdf problem).
This commit is contained in:
John MacFarlane
2011-02-11 18:55:14 -08:00
parent 459e460abb
commit 37fa6df612
+3 -2
View File
@@ -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