Commit 5bdb077b authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Force server locale to be UTF-8

parent ccde5822
Pipeline #5351 passed with stages
in 73 minutes and 40 seconds
...@@ -26,6 +26,7 @@ import Data.Maybe (fromJust) ...@@ -26,6 +26,7 @@ import Data.Maybe (fromJust)
import Data.Text (unpack, replace, pack) import Data.Text (unpack, replace, pack)
import Data.Text qualified as T import Data.Text qualified as T
import Data.Vector qualified as Vector import Data.Vector qualified as Vector
import GHC.IO.Encoding
import Gargantext.API.Ngrams.Prelude (toTermList) import Gargantext.API.Ngrams.Prelude (toTermList)
import Gargantext.API.Ngrams.Types import Gargantext.API.Ngrams.Types
import Gargantext.Core.Text.Context (TermList) import Gargantext.Core.Text.Context (TermList)
...@@ -253,6 +254,9 @@ fileToList parser path = ...@@ -253,6 +254,9 @@ fileToList parser path =
main :: IO () main :: IO ()
main = do main = do
setLocaleEncoding utf8
currentLocale <- getLocaleEncoding
printIOMsg $ "Machine locale: " <> show currentLocale
printIOMsg "Starting the reconstruction" printIOMsg "Starting the reconstruction"
printIOMsg "Read the configuration file" printIOMsg "Read the configuration file"
......
...@@ -28,6 +28,7 @@ import Gargantext.API (startGargantext) -- , startGargantextMock) ...@@ -28,6 +28,7 @@ import Gargantext.API (startGargantext) -- , startGargantextMock)
import Gargantext.API.Admin.EnvTypes import Gargantext.API.Admin.EnvTypes
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.System.Logging import Gargantext.System.Logging
import GHC.IO.Encoding
import Options.Generic import Options.Generic
import System.Exit (exitSuccess) import System.Exit (exitSuccess)
import qualified Paths_gargantext as PG -- cabal magic build module import qualified Paths_gargantext as PG -- cabal magic build module
...@@ -54,6 +55,11 @@ deriving instance Show (MyOptions Unwrapped) ...@@ -54,6 +55,11 @@ deriving instance Show (MyOptions Unwrapped)
main :: IO () main :: IO ()
main = withLogger () $ \ioLogger -> do main = withLogger () $ \ioLogger -> do
-- Sets the locale to avoid encoding issues like in #284.
setLocaleEncoding utf8
currentLocale <- getLocaleEncoding
MyOptions myMode myPort myIniFile myVersion <- unwrapRecord MyOptions myMode myPort myIniFile myVersion <- unwrapRecord
"Gargantext server" "Gargantext server"
--------------------------------------------------------------- ---------------------------------------------------------------
...@@ -75,6 +81,7 @@ main = withLogger () $ \ioLogger -> do ...@@ -75,6 +81,7 @@ main = withLogger () $ \ioLogger -> do
let start = case myMode of let start = case myMode of
Mock -> panic "[ERROR] Mock mode unsupported" Mock -> panic "[ERROR] Mock mode unsupported"
_ -> startGargantext myMode myPort' (unpack myIniFile') _ -> startGargantext myMode myPort' (unpack myIniFile')
logMsg ioLogger INFO $ "Starting with " <> show myMode <> " mode." logMsg ioLogger INFO $ "Starting with " <> show myMode <> " mode."
logMsg ioLogger INFO $ "Machine locale: " <> show currentLocale
start start
--------------------------------------------------------------- ---------------------------------------------------------------
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment