Commit 331923fd authored by Simon Marlow's avatar Simon Marlow

FIX #2302: print FastStrings in UTF-8 in error messages

This is all a bit of a mess, but can hopefully be improved when we get
encoding/decoding support in Handles.
parent ed1173a7
......@@ -83,7 +83,7 @@ import Control.Monad ( when )
import Data.Char
import System.FilePath
import System.IO ( hPutStrLn, stderr )
import System.IO ( stderr, hPutChar )
-- -----------------------------------------------------------------------------
-- DynFlags
......@@ -595,9 +595,14 @@ defaultDynFlags =
log_action = \severity srcSpan style msg ->
case severity of
SevInfo -> hPutStrLn stderr (show (msg style))
SevFatal -> hPutStrLn stderr (show (msg style))
_ -> hPutStrLn stderr ('\n':show ((mkLocMessage srcSpan msg) style))
SevInfo -> printErrs (msg style)
SevFatal -> printErrs (msg style)
_ -> do
hPutChar stderr '\n'
printErrs ((mkLocMessage srcSpan msg) style)
-- careful (#2302): printErrs prints in UTF-8, whereas
-- converting to string first and using hPutStr would
-- just emit the low 8 bits of each unicode char.
}
{-
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment