[commit: ghc] master: Fix string conversions in ghc-pkg to be correct w.r.t. Unicode (b00deb7)

git at git.haskell.org git at git.haskell.org
Fri Aug 29 14:04:18 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b00deb7ca4b3cf485252779f7515776f8f1f95b6/ghc

>---------------------------------------------------------------

commit b00deb7ca4b3cf485252779f7515776f8f1f95b6
Author: Duncan Coutts <duncan at well-typed.com>
Date:   Sun Aug 24 22:11:33 2014 +0100

    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.


>---------------------------------------------------------------

b00deb7ca4b3cf485252779f7515776f8f1f95b6
 utils/ghc-pkg/Main.hs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index cedc048..ec23eb4 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
 
 
 -- -----------------------------------------------------------------------------



More information about the ghc-commits mailing list