diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-10-16 16:50:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-16 16:50:14 -0700 |
commit | f98f101a67df9cdfcaa79a154afaa8102210275d (patch) | |
tree | d5a76c393ea17004e5c5e73741acda1603b39477 /haddock-api/src/Haddock/Backends/Hoogle.hs | |
parent | a631fb6c15de83042e9739285518fda72cfb3144 (diff) |
Set UTF-8 encoding before writing files (#934)
This should fix #929, as well as guard against future problems of this
sort in other places. Basically replaces 'writeFile' (which selects the
users default locale) with 'writeUtf8File' (which always uses utf8).
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hoogle.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Hoogle.hs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs index 885c608b..eb93ade2 100644 --- a/haddock-api/src/Haddock/Backends/Hoogle.hs +++ b/haddock-api/src/Haddock/Backends/Hoogle.hs @@ -36,7 +36,6 @@ import Data.Version import System.Directory import System.FilePath -import System.IO prefix :: [String] prefix = ["-- Hoogle documentation, generated by Haddock" @@ -56,10 +55,7 @@ ppHoogle dflags package version synopsis prologue ifaces odir = do | not (null (versionBranch version)) ] ++ concat [ppModule dflags' i | i <- ifaces, OptHide `notElem` ifaceOptions i] createDirectoryIfMissing True odir - h <- openFile (odir </> filename) WriteMode - hSetEncoding h utf8 - hPutStr h (unlines contents) - hClose h + writeUtf8File (odir </> filename) (unlines contents) ppModule :: DynFlags -> Interface -> [String] ppModule dflags iface = |