on master help sign in
Set encoding to UTF8 on Windows

For some inexplicable reason Haskell hardcodes latin1 as the encoding on Windows. This stops the output when an unicode character is reached. It's better all over to set the encoding to UTF8, if the user has a UTF8 terminal like mintty it looks good. If the user has a terminal with latin1, there will be some bad chars but they will see the entire text otherwise.

commit1b4b01c239f0a58efdfb466a53e3b35d44787748 authorNiklas Larsson <niklas@mm.st> dateSun 22 Feb 2015, 15:31 (12 years ago) parentf0d90e6
1 file changed+4−1
main/Main.hs+4−1
main/Main.hs+4−1
@@ -3,6 +3,7 @@ module Main where
33import System.Console.Haskeline
44import System.IO
55import System.Environment
6+import System.Info
67import System.Exit
78import System.FilePath ((</>), addTrailingPathSeparator)
89import System.Directory
@@ -38,7 +39,9 @@ import Paths_idris
3839-- on with the REPL.
3940
4041main :: IO ()
41−main = do opts <- runArgParser
42+main = do
43+ when (os == "mingw32") $ do hSetEncoding stdout utf8
44+ opts <- runArgParser
4245 runMain (runIdris opts)
4346
4447runIdris :: [Opt] -> Idris ()