diff options
author | Yuji Yamamoto <whosekiteneverfly@gmail.com> | 2017-07-04 23:13:12 +0900 |
---|---|---|
committer | Alex Biehl <alexbiehl@gmail.com> | 2017-07-04 16:13:12 +0200 |
commit | 22cbf4d9509d3b537e6c2fcf4c95ae73d930b9aa (patch) | |
tree | f6dbab9928bdcc3c59838df99e05b9040918b321 /html-test/src/BundledPatterns2.hs | |
parent | 58edf9f5757daadeeaa7879785c48363fa154996 (diff) |
Avoid errors on non UTF-8 Windows (#566)
* Avoid errors on non UTF-8 Windows
Problem
====
haddock exits with errors like below:
`(1)`
```
haddock: internal error: <stderr>: hPutChar: invalid argument (invalid character)
```
`(2)`
```
haddock: internal error: Language\Haskell\HsColour\Anchors.hs: hGetContents: invalid argument (invalid byte sequence)
```
`(1)` is caused by printing [the "bullet" character](http://www.fileformat.info/info/unicode/char/2022/index.htm) onto stderr.
For example, this warning contains it:
```
Language\Haskell\HsColour\ANSI.hs:62:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘toEnum’
• In the instance declaration for ‘Enum Highlight’
```
`(2)` is caused when the input file of `readFile` contains some Unicode characters.
In the case above, '⇒' is the cause.
Environment
----
OS: Windows 10
haddock: 2.17.3
GHC: 8.0.1
Solution
====
Add `hSetEncoding handle utf8` to avoid the errors.
Note
====
- I found the detailed causes by these changes for debugging:
- https://github.com/haskell/haddock/commit/8f29edb6b02691c1cf4c479f6c6f3f922b35a55b
- https://github.com/haskell/haddock/commit/1dd23bf2065a1e1f2c14d0f4abd847c906b4ecb4
- These errors happen even after executing `chcp 65001` on the console.
According to the debug code, `hGetEncoding stderr` returns `CP932` regardless of the console encoding.
* Avoid 'internal error: <stderr>: hPutChar: invalid argument (invalid character)' non UTF-8 Windows
Better solution for 59411754a6db41d17820733c076e6a72bcdbd82b's (1)
Diffstat (limited to 'html-test/src/BundledPatterns2.hs')
0 files changed, 0 insertions, 0 deletions