@@ -19,7 +19,7 @@ import Distribution.Text ( simpleParse )
1919import System.Directory ( doesDirectoryExist, doesFileExist, createDirectoryIfMissing, getHomeDirectory, getDirectoryContents )
2020import System.Exit ( exitFailure )
2121import System.FilePath ( (</>), (<.>) )
22−import System.IO ( hPutStrLn, stderr, hPutStr )
22+import System.IO ( hPutStrLn, stderr, hPutStr, openFile, InputMode(ReadMode), hSetEncoding, utf8, hGetContents )
2323
2424data Package = Package
2525 { pkgSource :: DerivationSource
@@ -143,7 +143,9 @@ cabalFromFile failHard file =
143143 -- wrap the whole block in `catchIO`, because of lazy IO. The `case` will force
144144 -- the reading of the file, so we will always catch the expression here.
145145 MaybeT $ handleIO (\err -> Nothing <$ hPutStrLn stderr ("*** parsing cabal file: " ++ show err)) $ do
146− content <- readFile file
146+ inputHandle <- openFile ReadMode file
147+ hSetEncoding inputHandle utf8
148+ content <- hGetContent inputHandle
147149 case Cabal.parsePackageDescription content of
148150 Cabal.ParseFailed e | failHard -> do
149151 let (line, err) = ParseUtils.locatedErrorMsg e