aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-02-11 18:55:14 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-02-11 18:55:14 -0800
commit37fa6df612c5d02acd7ff177293e2d7c4630ccb2 (patch)
treead21d7f8184748902b26773effa3e8c55bd39368 /src/Text/Pandoc
parent459e460abbfb6de707621e958699ed7f0ea62d7f (diff)
downloadpandoc-37fa6df612c5d02acd7ff177293e2d7c4630ccb2.tar.gz
UTF8: Encode filenames.
(This is still needed, even with recent base.) Partially resolves Issue #286 (though now there is a new markdown2pdf problem).
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/UTF8.hs5
1 files 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