disco
disco copied to clipboard
Unicode causes printing errors on Windows
When printing a result that contains a Unicode character that character and everything after is replaced with an error like <stdout>: commitBuffer: invalid argument (invalid character)
. This seems to be Windows specific, and still occurs in environments that support Unicode (i.e. Windows' new terminal). A workaround is executing chcp 65001
to put the shell UTF-8 Mode, though this seems like it might be a better solution. Perhaps we can find a way to make Windows' shell go into UTF-8 when running the language or at least mention this in the setup documentation.
This is relevant: https://mail.haskell.org/pipermail/haskell-cafe/2021-November/134818.html
What version of GHC are your students using? I believe sufficiently recent versions of ghc (but I don't know which; this may require 9.2.1) have an RTS option to use a new I/O manager, which among other things implements the widechar API for console I/O.
I found an email from Tamar https://mail.haskell.org/pipermail/ghc-devs/2020-July/019053.html that says the new Windows I/O manager is available in 8.12+, and is enabled with +RTS --io-manager=native
Students have definitely been running into this. Now that the latest stack LTS-19.0 has moved to GHC 9.0, we should try upgrading to that and specifying +RTS --io-manager=native
in the .cabal
file.
Did what the above comment suggests --- upgraded to LTS-19.8 and added that GHC option to use the native IO manager. Someone on Windows will have to check whether this resolves the issue.