diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2018-05-13 18:36:59 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-05-13 22:22:43 -0400 |
commit | cf88c2b109a9f36d151af7fa0e542c48c98115fa (patch) | |
tree | d5062954d5a55e88a9a8808751dfc8ae8f4fbd9a /ghc/Main.hs | |
parent | 21e1a00c0ccf3072ccc04cd1acfc541c141189d2 (diff) | |
download | haskell-cf88c2b109a9f36d151af7fa0e542c48c98115fa.tar.gz |
ghc-pkg: Configure handle encodings
This fixes #15021 using a the same approach as was used to fix the issue
in ghc (#10762).
Test Plan: Validate on Windows as user whose username contains
non-ASCII characters
Reviewers: simonmar
Reviewed By: simonmar
Subscribers: lehins, thomie, carter
GHC Trac Issues: #15021
Differential Revision: https://phabricator.haskell.org/D4642
Diffstat (limited to 'ghc/Main.hs')
-rw-r--r-- | ghc/Main.hs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs index b720dea3db..276546bc95 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -40,6 +40,7 @@ import Module ( ModuleName ) -- Various other random stuff that we need +import GHC.HandleEncoding import Config import Constants import HscTypes @@ -92,18 +93,7 @@ main = do hSetBuffering stdout LineBuffering hSetBuffering stderr LineBuffering - -- Handle GHC-specific character encoding flags, allowing us to control how - -- GHC produces output regardless of OS. - env <- getEnvironment - case lookup "GHC_CHARENC" env of - Just "UTF-8" -> do - hSetEncoding stdout utf8 - hSetEncoding stderr utf8 - _ -> do - -- Avoid GHC erroring out when trying to display unhandled characters - hSetTranslit stdout - hSetTranslit stderr - + configureHandleEncoding GHC.defaultErrorHandler defaultFatalMessager defaultFlushOut $ do -- 1. extract the -B flag from the args argv0 <- getArgs |