Skip to content

Calling fail on a UTF-8 encoded string (in file) causes garbage to be printed

For example,

guerrilla@delta:/tmp/foo$ cat Test.hs 
module Main where

main :: IO ()
main =
    do
        putStrLn "μ"
        fail "μ"
guerrilla@delta:/tmp/foo$ ./Test 
μ
Test: user error (�)
guerrilla@delta:/tmp/foo$ ./Test 2>&1 | xxd
0000000: cebc 0a54 6573 743a 2075 7365 7220 6572  ...Test: user er
0000010: 726f 7220 28bc 290a                      ror (.).

Using either encodeString or writing it in escaped hexidecimal does work.

Edited by Simon Marlow
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information