@@ -5,8 +5,11 @@ import ProjectM36.Client
5import ProjectM36.Server.ParseArgs
5import ProjectM36.Server.ParseArgs
6import ProjectM36.Server
6import ProjectM36.Server
7import System.IO
7import System.IO
8import Options.Applicative
9import Options.Applicative
9import System.Exit
10import System.Exit
11+import System.Environment
10#if __GLASGOW_HASKELL__ < 804
13#if __GLASGOW_HASKELL__ < 804
11import Data.Monoid
14import Data.Monoid
@@ -86,8 +89,15 @@ printWelcome = do
86 putStrLn "A full tutorial is available at:"
89 putStrLn "A full tutorial is available at:"
87 putStrLn "https://github.com/agentm/project-m36/blob/master/docs/tutd_tutorial.markdown"
90 putStrLn "https://github.com/agentm/project-m36/blob/master/docs/tutd_tutorial.markdown"
92+-- | If the locale is set to ASCII, upgrade it to UTF-8 because tutd outputs UTF-8-encoded attributes. This is especially important in light docker images where the locale data may be missing.
93+setLocaleIfNecessary :: IO ()
94+setLocaleIfNecessary = do
95+ l <- getLocaleEncoding
96+ when (textEncodingName l == "ASCII") (setLocaleEncoding utf8)
89main :: IO ()
98main :: IO ()
100+ setLocaleIfNecessary
91 interpreterConfig <- execParser opts
101 interpreterConfig <- execParser opts
92 let connInfo = connectionInfoForConfig interpreterConfig
102 let connInfo = connectionInfoForConfig interpreterConfig
93 fscheck <- checkFSType (checkFSForConfig interpreterConfig) (fromMaybe NoPersistence (persistenceStrategyForConfig interpreterConfig))
103 fscheck <- checkFSType (checkFSForConfig interpreterConfig) (fromMaybe NoPersistence (persistenceStrategyForConfig interpreterConfig))