aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src
diff options
context:
space:
mode:
authorYuji Yamamoto <whosekiteneverfly@gmail.com>2018-07-23 15:16:01 +0900
committerAlexander Biehl <alexbiehl@gmail.com>2018-07-23 08:16:01 +0200
commit1868443b01232d57ec11dfc831ac0a6915a2b337 (patch)
treec08a5adb3d891f34260ffc38f25e9885752af680 /haddock-api/src
parent532b209d127e4cecdbf7e9e3dcf4f653a5605b5a (diff)
Avoid "invalid argument (invalid character)" on non-unicode Windows (#892)
Steps to reproduce and the error message ==== ``` > stack haddock basement ... snip ... Warning: 'A' is out of scope. Warning: 'haddock: internal error: <stdout>: commitBuffer: invalid argument (invalid character) ``` Environment ==== OS: Windows 10 ver. 1709 haddock: [HEAD of ghc-8.4 when I reproduce the error](https://github.com/haskell/haddock/commit/532b209d127e4cecdbf7e9e3dcf4f653a5605b5a). (I had to use this version to avoid another probrem already fixed in HEAD) GHC: 8.4.3 stack: Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2 Related pull request ==== https://github.com/haskell/haddock/pull/566
Diffstat (limited to 'haddock-api/src')
-rw-r--r--haddock-api/src/Haddock/Interface.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/haddock-api/src/Haddock/Interface.hs b/haddock-api/src/Haddock/Interface.hs
index a66745ea..7c7f0e75 100644
--- a/haddock-api/src/Haddock/Interface.hs
+++ b/haddock-api/src/Haddock/Interface.hs
@@ -81,6 +81,7 @@ processModules
processModules verbosity modules flags extIfaces = do
#if defined(mingw32_HOST_OS)
-- Avoid internal error: <stderr>: hPutChar: invalid argument (invalid character)' non UTF-8 Windows
+ liftIO $ hSetEncoding stdout $ mkLocaleEncoding TransliterateCodingFailure
liftIO $ hSetEncoding stderr $ mkLocaleEncoding TransliterateCodingFailure
#endif