diff options
| author | krasimir <krasimir@chalmers.se> | 2010-04-28 17:37:53 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-04-28 17:37:53 +0000 |
| commit | 68de1cead3a64d42e21b8668415596925b284b18 (patch) | |
| tree | 850426c9b605fb1947b1ffa2fad5e0a0a053f41a /src | |
| parent | 6e7bbf3aa82a90f1b0ca38e3915972d02c5c8239 (diff) | |
wf,vt,vp,vd,aw should store files in utf8
Diffstat (limited to 'src')
| -rw-r--r-- | src/compiler/GF/Command/Commands.hs | 10 | ||||
| -rw-r--r-- | src/compiler/GF/Infra/UseIO.hs | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 92590a403..5aaa62aca 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -155,7 +155,7 @@ allCommands env@(pgf, mos) = Map.fromList [ let file s = "_grph." ++ s let view = optViewGraph opts let format = optViewFormat opts - writeFile (file "dot") grph + writeUTF8File (file "dot") grph system $ "dot -T" ++ format ++ " " ++ file "dot" ++ " > " ++ file format system $ view ++ " " ++ file format return void @@ -737,7 +737,7 @@ allCommands env@(pgf, mos) = Map.fromList [ let file s = "_grphd." ++ s let view = optViewGraph opts let format = optViewFormat opts - writeFile (file "dot") grphs + writeUTF8File (file "dot") grphs system $ "dot -T" ++ format ++ " " ++ file "dot" ++ " > " ++ file format system $ view ++ " " ++ file format return void @@ -778,7 +778,7 @@ allCommands env@(pgf, mos) = Map.fromList [ let file s = "_grph." ++ s let view = optViewGraph opts let format = optViewFormat opts - writeFile (file "dot") grph + writeUTF8File (file "dot") grph system $ "dot -T" ++ format ++ " " ++ file "dot" ++ " > " ++ file format system $ view ++ " " ++ file format return void @@ -818,7 +818,7 @@ allCommands env@(pgf, mos) = Map.fromList [ let file s = "_grph." ++ s let view = optViewGraph opts let format = optViewFormat opts - writeFile (file "dot") grph + writeUTF8File (file "dot") grph system $ "dot -T" ++ format ++ " " ++ file "dot" ++ " > " ++ file format system $ view ++ " " ++ file format return void @@ -844,7 +844,7 @@ allCommands env@(pgf, mos) = Map.fromList [ let file = valStrOpts "file" "_gftmp" opts if isOpt "append" opts then appendFile file (toString arg) - else writeFile file (toString arg) + else writeUTF8File file (toString arg) return void, options = [ ("append","append to file, instead of overwriting it") diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs index bb1a75b6e..3940e6be1 100644 --- a/src/compiler/GF/Infra/UseIO.hs +++ b/src/compiler/GF/Infra/UseIO.hs @@ -184,3 +184,10 @@ putPointE v opts msg act = do else when (verbAtLeast opts v) $ putStrLnE "" return a + +writeUTF8File :: FilePath -> String -> IO () +writeUTF8File fpath content = do + h <- openFile fpath WriteMode + hSetEncoding h utf8 + hPutStr h content + hClose h |
