From 1cc11e60863abdbe3d0e05b73f53d0377cd8fec2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 6 May 2010 20:29:44 -0700 Subject: Use new UTF8 module in Shared, ODT, and the executables. --- src/Text/Pandoc/ODT.hs | 1 - src/Text/Pandoc/Shared.hs | 16 +++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/ODT.hs b/src/Text/Pandoc/ODT.hs index d978c0cb4..a69d9d4e4 100644 --- a/src/Text/Pandoc/ODT.hs +++ b/src/Text/Pandoc/ODT.hs @@ -32,7 +32,6 @@ import Data.List ( find ) import System.FilePath ( (), takeFileName ) import qualified Data.ByteString.Lazy as B import Data.ByteString.Lazy.UTF8 ( fromString ) -import Prelude hiding ( writeFile, readFile ) import Codec.Archive.Zip import Control.Applicative ( (<$>) ) import Text.ParserCombinators.Parsec diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 26aff4250..274c969ca 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -112,6 +112,7 @@ module Text.Pandoc.Shared ( ) where import Text.Pandoc.Definition +import qualified Text.Pandoc.UTF8 as UTF8 (readFile, putStrLn) import Text.ParserCombinators.Parsec import Text.PrettyPrint.HughesPJ ( Doc, fsep, ($$), (<>), empty, isEmpty, text, nest ) import qualified Text.PrettyPrint.HughesPJ as PP @@ -123,13 +124,6 @@ import Network.URI ( parseURI, URI (..), isAllowedInURI, escapeURIString, unEsca import Codec.Binary.UTF8.String ( encodeString, decodeString ) import System.Directory import System.FilePath ( () ) --- Note: ghc >= 6.12 (base >=4.2) supports unicode through iconv --- So we use System.IO.UTF8 only if we have an earlier version -#if MIN_VERSION_base(4,2,0) -#else -import Prelude hiding ( putStr, putStrLn, writeFile, readFile, getContents ) -import System.IO.UTF8 -#endif import Data.Generics import qualified Control.Monad.State as S import Control.Monad (join) @@ -676,7 +670,7 @@ readWith parser state input = testStringWith :: (Show a) => GenParser Char ParserState a -> String -> IO () -testStringWith parser str = putStrLn $ show $ +testStringWith parser str = UTF8.putStrLn $ show $ readWith parser defaultParserState str -- | Parsing options. @@ -1074,6 +1068,6 @@ inDirectory path action = do readDataFile :: Maybe FilePath -> FilePath -> IO String readDataFile userDir fname = case userDir of - Nothing -> getDataFileName fname >>= readFile - Just u -> catch (readFile $ u fname) - (\_ -> getDataFileName fname >>= readFile) + Nothing -> getDataFileName fname >>= UTF8.readFile + Just u -> catch (UTF8.readFile $ u fname) + (\_ -> getDataFileName fname >>= UTF8.readFile) -- cgit v1.2.3