on master help sign in
Force UTF8 handling of build-plan.txt #90
commit7ab077e67ea4d96651275b2adb64fe536d20173d authorMichael Snoyman <michael@snoyman.com> dateMon 29 Jul 2013, 12:20 (13 years ago) parent7b91003
2 files changed+4−2
Stackage/BuildPlan.hs+3−2 stackage.cabal+1
Stackage/BuildPlan.hs+3−2
@@ -9,17 +9,18 @@ import qualified Data.Map as Map
99import qualified Data.Set as Set
1010import Distribution.Text (display, simpleParse)
1111import Stackage.Types
12+import qualified System.IO.UTF8
1213
1314readBuildPlan :: FilePath -> IO BuildPlan
1415readBuildPlan fp = do
15− str <- readFile fp
16+ str <- System.IO.UTF8.readFile fp
1617 case fromString str of
1718 Left s -> error $ "Could not read build plan: " ++ s
1819 Right (x, "") -> return x
1920 Right (_, _:_) -> error "Trailing content when reading build plan"
2021
2122writeBuildPlan :: FilePath -> BuildPlan -> IO ()
22−writeBuildPlan fp bp = writeFile fp $ toString bp
23+writeBuildPlan fp bp = System.IO.UTF8.writeFile fp $ toString bp
2324
2425class AsString a where
2526 toString :: a -> String
stackage.cabal+1
@@ -41,6 +41,7 @@ library
4141 , old-locale
4242 , HTTP
4343 , time
44+ , utf8-string
4445
4546executable stackage
4647 hs-source-dirs: app