summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-05-06 20:29:44 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2010-05-06 22:28:28 -0700
commit1cc11e60863abdbe3d0e05b73f53d0377cd8fec2 (patch)
treefd8faa5c176f71dc9c55701ef3ccd4ce7a6a2de3 /src/Text
parent7be82b45361e65939008bb93f0006c10dad946d5 (diff)
Use new UTF8 module in Shared, ODT, and the executables.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/ODT.hs1
-rw-r--r--src/Text/Pandoc/Shared.hs16
2 files changed, 5 insertions, 12 deletions
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)