diff options
Diffstat (limited to 'Utility/Misc.hs')
-rw-r--r-- | Utility/Misc.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Utility/Misc.hs b/Utility/Misc.hs index c9bfcb953..c4992e142 100644 --- a/Utility/Misc.hs +++ b/Utility/Misc.hs @@ -11,6 +11,14 @@ import System.IO import System.IO.Error (try) import Control.Monad import Control.Applicative +import GHC.IO.Encoding + +{- Sets a Handle to use the filesystem encoding. This causes data + - written or read from it to be encoded/decoded the same + - as ghc 7.4 does to filenames et. This special encoding + - allows "arbitrary undecodable bytes to be round-tripped through it". -} +fileEncoding :: Handle -> IO () +fileEncoding h = hSetEncoding h =<< getFileSystemEncoding {- A version of hgetContents that is not lazy. Ensures file is - all read before it gets closed. -} |