@@ -52,7 +52,8 @@ import Codec.Binary.UTF8.String (encodeString, decodeString)
53import System.IO hiding (readFile, writeFile, getContents,
53import System.IO hiding (readFile, writeFile, getContents,
54 putStr, putStrLn, hPutStr, hPutStrLn, hGetContents)
54 putStr, putStrLn, hPutStr, hPutStrLn, hGetContents)
55−import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn )
55+import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn,
56import qualified System.IO as IO
57import qualified System.IO as IO
57import qualified Data.ByteString.Char8 as B
58import qualified Data.ByteString.Char8 as B
58import qualified Data.ByteString.Lazy as BL
59import qualified Data.ByteString.Lazy as BL
@@ -86,9 +87,10 @@ hPutStrLn :: Handle -> String -> IO ()
86hPutStrLn h s = hSetEncoding h utf8 >> IO.hPutStrLn h s
87hPutStrLn h s = hSetEncoding h utf8 >> IO.hPutStrLn h s
88hGetContents :: Handle -> IO String
89hGetContents :: Handle -> IO String
90+hGetContents h = fmap (TL.unpack . TL.decodeUtf8) $ BL.hGetContents h
89−hGetContents h = hSetEncoding h utf8_bom
91+-- hGetContents h = hSetEncoding h utf8_bom
90− >> hSetNewlineMode h universalNewlineMode
92+-- >> hSetNewlineMode h universalNewlineMode
91− >> IO.hGetContents h
93+-- >> IO.hGetContents h
93toString :: B.ByteString -> String
95toString :: B.ByteString -> String
94toString = T.unpack . T.decodeUtf8With lenientDecode
96toString = T.unpack . T.decodeUtf8With lenientDecode