disco icon indicating copy to clipboard operation
disco copied to clipboard

Unicode causes printing errors on Windows

Open ericpinter opened this issue 3 years ago • 3 comments

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.

ericpinter avatar Sep 21 '20 02:09 ericpinter

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

byorgey avatar Dec 11 '21 03:12 byorgey

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.

byorgey avatar Mar 25 '22 15:03 byorgey

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.

byorgey avatar May 26 '22 19:05 byorgey