summaryrefslogtreecommitdiff
path: root/utils/ghc-pkg
diff options
context:
space:
mode:
authorDuncan Coutts <duncan@well-typed.com>2014-08-24 22:11:33 +0100
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-08-29 12:39:05 +0100
commitb00deb7ca4b3cf485252779f7515776f8f1f95b6 (patch)
tree40ab682b3c5d63d33387b07ac179e1a6553af388 /utils/ghc-pkg
parentc72efd7cee77d5f934bbede4ddf680ea348467db (diff)
downloadhaskell-b00deb7ca4b3cf485252779f7515776f8f1f95b6.tar.gz
Fix string conversions in ghc-pkg to be correct w.r.t. Unicode
Similar change to that on the ghc library side in the previous patch. The BinaryStringRep class has to use a ByteString in UTF8 encoding.
Diffstat (limited to 'utils/ghc-pkg')
-rw-r--r--utils/ghc-pkg/Main.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index cedc048f03..ec23eb47b2 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -24,6 +24,7 @@ import Distribution.ModuleExport
import Distribution.Package hiding (depends)
import Distribution.Text
import Distribution.Version
+import Distribution.Simple.Utils (fromUTF8, toUTF8)
import System.FilePath as FilePath
import qualified System.FilePath.Posix as FilePath.Posix
import System.Process
@@ -1075,12 +1076,12 @@ convertPackageInfoToCacheFormat pkg =
}
instance GhcPkg.BinaryStringRep ModuleName where
- fromStringRep = ModuleName.fromString . BS.unpack
- toStringRep = BS.pack . display
+ fromStringRep = ModuleName.fromString . fromUTF8 . BS.unpack
+ toStringRep = BS.pack . toUTF8 . display
instance GhcPkg.BinaryStringRep String where
- fromStringRep = BS.unpack
- toStringRep = BS.pack
+ fromStringRep = fromUTF8 . BS.unpack
+ toStringRep = BS.pack . toUTF8
-- -----------------------------------------------------------------------------