diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-09-23 11:01:33 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-09-23 11:01:33 -0700 |
commit | c69837adb648a479167be5e2d37279a02be8060c (patch) | |
tree | b2ebd425f54252c2a9706acdff6283ec089f6d55 /src/pandoc.hs | |
parent | 4d65063592beb2e1d2bf3ab7e8768536b6e2028c (diff) |
Use local encoding for input/output rather than forcing UTF8.
Note that system templates are stored as UTF8
and will still be read as such, even if the local encoding
is different. Text downloaded from URLs will also be treated
as UTF-8.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r-- | src/pandoc.hs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs index 9cfaaeefe..358e85fcd 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -363,7 +363,7 @@ options = , Option "H" ["include-in-header"] (ReqArg (\arg opt -> do - text <- UTF8.readFile arg + text <- readFile arg -- add new ones to end, so they're included in order specified let newvars = optVariables opt ++ [("header-includes",text)] return opt { optVariables = newvars, @@ -374,7 +374,7 @@ options = , Option "B" ["include-before-body"] (ReqArg (\arg opt -> do - text <- UTF8.readFile arg + text <- readFile arg -- add new ones to end, so they're included in order specified let newvars = optVariables opt ++ [("include-before",text)] return opt { optVariables = newvars, @@ -385,7 +385,7 @@ options = , Option "A" ["include-after-body"] (ReqArg (\arg opt -> do - text <- UTF8.readFile arg + text <- readFile arg -- add new ones to end, so they're included in order specified let newvars = optVariables opt ++ [("include-after",text)] return opt { optVariables = newvars, @@ -528,7 +528,7 @@ options = , Option "" ["epub-stylesheet"] (ReqArg (\arg opt -> do - text <- UTF8.readFile arg + text <- readFile arg return opt { optEPUBStylesheet = Just text }) "FILENAME") "" -- "Path of epub.css" @@ -544,7 +544,7 @@ options = , Option "" ["epub-metadata"] (ReqArg (\arg opt -> do - text <- UTF8.readFile arg + text <- readFile arg return opt { optEPUBMetadata = text }) "FILENAME") "" -- "Path of epub metadata file" @@ -756,7 +756,7 @@ defaultWriterName x = main :: IO () main = do - rawArgs <- liftM (map decodeArg) getArgs + rawArgs <- liftM (map UTF8.decodeArg) getArgs prg <- getProgName let compatMode = (prg == "hsmarkdown") @@ -888,7 +888,7 @@ main = do let tp' = case takeExtension tp of "" -> tp <.> format _ -> tp - E.catch (UTF8.readFile tp') + E.catch (readFile tp') (\e -> if isDoesNotExistError e then E.catch (readDataFile datadir $ @@ -982,11 +982,11 @@ main = do let readSources [] = mapM readSource ["-"] readSources srcs = mapM readSource srcs - readSource "-" = UTF8.getContents + readSource "-" = getContents readSource src = case parseURI src of Just u | uriScheme u `elem` ["http:","https:"] -> readURI u - _ -> UTF8.readFile src + _ -> readFile src readURI uri = simpleHTTP (mkRequest GET uri) >>= getResponseBody >>= return . toString -- treat all as UTF8 @@ -1026,8 +1026,8 @@ main = do writeBinary = B.writeFile (UTF8.encodePath outputFile) let writerFn :: FilePath -> String -> IO () - writerFn "-" = UTF8.putStr - writerFn f = UTF8.writeFile f + writerFn "-" = putStr + writerFn f = writeFile (UTF8.encodePath f) case getWriter writerName' of Left e -> err 9 e |