@@ -52,7 +52,8 @@ import Codec.Binary.UTF8.String (encodeString, decodeString)
5252
5353import System.IO hiding (readFile, writeFile, getContents,
5454 putStr, putStrLn, hPutStr, hPutStrLn, hGetContents)
55−import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn )
55+import Prelude hiding (readFile, writeFile, getContents, putStr, putStrLn,
56+ catch)
5657import qualified System.IO as IO
5758import qualified Data.ByteString.Char8 as B
5859import qualified Data.ByteString.Lazy as BL
@@ -86,9 +87,10 @@ hPutStrLn :: Handle -> String -> IO ()
8687hPutStrLn h s = hSetEncoding h utf8 >> IO.hPutStrLn h s
8788
8889hGetContents :: Handle -> IO String
89−hGetContents h = hSetEncoding h utf8_bom
90− >> hSetNewlineMode h universalNewlineMode
91− >> IO.hGetContents h
90+hGetContents h = fmap (TL.unpack . TL.decodeUtf8) $ BL.hGetContents h
91+-- hGetContents h = hSetEncoding h utf8_bom
92+-- >> hSetNewlineMode h universalNewlineMode
93+-- >> IO.hGetContents h
9294
9395toString :: B.ByteString -> String
9496toString = T.unpack . T.decodeUtf8With lenientDecode