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 /compiler/utils | |
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 'compiler/utils')
-rw-r--r-- | compiler/utils/Util.hs | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index d0a38ec240..9523c08ff2 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -98,7 +98,6 @@ module Util ( doesDirNameExist, getModificationUTCTime, modificationTimeIfExists, - hSetTranslit, global, consIORef, globalM, sharedGlobal, sharedGlobalM, @@ -145,9 +144,7 @@ import GHC.Stack (HasCallStack) import Control.Applicative ( liftA2 ) import Control.Monad ( liftM, guard ) -import GHC.IO.Encoding (mkTextEncoding, textEncodingName) import GHC.Conc.Sync ( sharedCAF ) -import System.IO (Handle, hGetEncoding, hSetEncoding) import System.IO.Error as IO ( isDoesNotExistError ) import System.Directory ( doesDirectoryExist, getModificationTime ) import System.FilePath @@ -1256,18 +1253,6 @@ modificationTimeIfExists f = do else ioError e -- -------------------------------------------------------------- --- Change the character encoding of the given Handle to transliterate --- on unsupported characters instead of throwing an exception - -hSetTranslit :: Handle -> IO () -hSetTranslit h = do - menc <- hGetEncoding h - case fmap textEncodingName menc of - Just name | '/' `notElem` name -> do - enc' <- mkTextEncoding $ name ++ "//TRANSLIT" - hSetEncoding h enc' - _ -> return () - -- split a string at the last character where 'pred' is True, -- returning a pair of strings. The first component holds the string -- up (but not including) the last character for which 'pred' returned |