summaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-09-23 22:12:21 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-09-23 22:12:21 -0700
commit7272735b3d413a644fd9ab01eeae8ae9cd5a925b (patch)
treebb0fa978cee6702d0bb3300f234b1f08d2071c5f /src/pandoc.hs
parent31107741f0ee69d444e5f9ed2d8272583024e10c (diff)
More intelligent handling of text encodings.
Previously, UTF-8 was enforced for both input and output. The new system: * For input, UTF-8 is tried first; if an error is raised, the locale encoding is tried. * For output, the locale encoding is always used.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 305557f6a..33fbd2152 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -46,7 +46,7 @@ import System.Console.GetOpt
import Data.Char ( toLower )
import Data.List ( intercalate, isPrefixOf )
import System.Directory ( getAppUserDataDirectory, doesFileExist, findExecutable )
-import System.IO ( stdout )
+import System.IO ( stdout, hPutStr, hPutStrLn )
import System.IO.Error ( isDoesNotExistError )
import qualified Control.Exception as E
import Control.Exception.Extensible ( throwIO )
@@ -312,7 +312,7 @@ options =
(\arg _ -> do
templ <- getDefaultTemplate Nothing arg
case templ of
- Right t -> UTF8.hPutStr stdout t
+ Right t -> hPutStr stdout t
Left e -> error $ show e
exitWith ExitSuccess)
"FORMAT")
@@ -663,7 +663,7 @@ options =
(NoArg
(\_ -> do
prg <- getProgName
- UTF8.hPutStrLn stdout (prg ++ " " ++ pandocVersion ++ compileInfo ++
+ hPutStrLn stdout (prg ++ " " ++ pandocVersion ++ compileInfo ++
copyrightMessage)
exitWith ExitSuccess ))
"" -- "Print version"
@@ -672,7 +672,7 @@ options =
(NoArg
(\_ -> do
prg <- getProgName
- UTF8.hPutStr stdout (usageMessage prg options)
+ hPutStr stdout (usageMessage prg options)
exitWith ExitSuccess ))
"" -- "Show help"
@@ -827,8 +827,8 @@ main = do
} = opts
when dumpArgs $
- do UTF8.hPutStrLn stdout outputFile
- mapM_ (\arg -> UTF8.hPutStrLn stdout arg) args
+ do hPutStrLn stdout outputFile
+ mapM_ (\arg -> hPutStrLn stdout arg) args
exitWith ExitSuccess
let sources = if ignoreArgs then [] else args
@@ -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 f
case getWriter writerName' of
Left e -> err 9 e