plaidfinch / StrictCheck

Keep your laziness in check!
https://hackage.haskell.org/package/StrictCheck.
MIT License
32 stars 4 forks source link

Error diagnostic crashes on Windows #1

Open plaidfinch opened 6 years ago

plaidfinch commented 6 years ago

Via /u/Tarmen, we have a bug report posted on Reddit. The relevant piece seems to be:

...on windows the error reporting breaks with

*** Failed! Falsifiable (after 15 tests and 6 shrinks):
┌──────────────┐   ┌─────────────────────┐
│ Inputs       ├───┤ Demand on result    │
├──────────────┤   ├─────────────────────┤
│ StrictCheckTest.EXE: <stdout>: commitBuffer: invalid argument (invalid character)

I suspect this is due to issues with Unicode text handling. The crash occurs right before StrictCheck would ordinarily print the Unicode bullet character (U+2022).

A search of bug reports seems to indicate this is a locale issue, in particular this StackOverflow answer says that this issue might be resolved by runningsetLocaleEncoding utf8 before printing text. It references the documentation for GHC.IO.Encoding, as noted in part of the Hakyll FAQ.

Tarmean commented 6 years ago

setLocalEncoding utf8 did not fix the issue for me. However running chcp 65001, $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding or using WSL did. I think this might be ghc beeing too conservative since Powershell can output unicode characters even without the codepage change - it's piping where things would break.

The unicode bullet/arrow is still rendered as a missing character in all fonts I tried, even ones where the equivalent linux version worked. That's only mildly annoying, though, and it turns out the artifacts I saw at first are actually a bug in the neovim terminal emulator in the presence of missing characters.

plaidfinch commented 6 years ago

Hmm, that's frustrating indeed. Perhaps we should detect when we're running on Windows and use different characters. Thanks for the update!

plaidfinch commented 6 years ago

@Tarmean, I would like to try and fix this issue, but I don't have access to a Windows license. Would you be willing to help debug this problem?