diff options
| author | hallgren <hallgren@chalmers.se> | 2012-10-05 12:54:49 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2012-10-05 12:54:49 +0000 |
| commit | b5bf276e9c82505038f4269a77ba3c6e201438bb (patch) | |
| tree | 49631e5553bd676b8ab4fd07fa8f4cebd3de0dee /src/compiler/GFI.hs | |
| parent | 2d371b768122695ce0bd37f10e3d6b0381c31a57 (diff) | |
Factor out code for setting the console encoding
Moved similar low-level code blocks in Main and GFI for setting the console
encoding to the new module GF.System.Console.
Diffstat (limited to 'src/compiler/GFI.hs')
| -rw-r--r-- | src/compiler/GFI.hs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/compiler/GFI.hs b/src/compiler/GFI.hs index 136f52972..9c62d1fd0 100644 --- a/src/compiler/GFI.hs +++ b/src/compiler/GFI.hs @@ -50,10 +50,7 @@ import qualified GF.System.Signal as IO(runInterruptibly) #ifdef SERVER_MODE import GFServer(server) #endif -#ifdef mingw32_HOST_OS -import System.Win32.Console -import System.Win32.NLS -#endif +import GF.System.Console(changeConsoleEncoding) import GF.Infra.BuildInfo(buildInfo) import Data.Version(showVersion) @@ -315,21 +312,7 @@ execute1 opts gfenv0 s0 = set_encoding [c] = do let cod = renameEncoding c - restricted $ do -#ifdef mingw32_HOST_OS - case cod of - 'C':'P':c -> case reads c of - [(cp,"")] -> do setConsoleCP cp - setConsoleOutputCP cp - _ -> return () - "UTF-8" -> do setConsoleCP 65001 - setConsoleOutputCP 65001 - _ -> return () -#endif - enc <- mkTextEncoding cod - hSetEncoding stdin enc - hSetEncoding stdout enc - hSetEncoding stderr enc + restricted $ changeConsoleEncoding cod continue gfenv set_encoding _ = putStrLn "se command not parsed" >> continue gfenv |
