put in utf8 forcing workaround

Haskell's IO layer crashes on characters > 255 when in a non-unicode (latin1)
locale. Until Haskell gets better behavior, put in an admittedly ugly
workaround for that: git-annex forces utf8 output mode no matter what
locale is selected. So if you use a non-utf8 locale, your filenames with
characters > 127 will not be displayed as you'd expect. But at least it
won't crash.
This commit is contained in:
Joey Hess 2011-03-08 18:05:20 -04:00
parent b85c91743c
commit 26544de946
5 changed files with 20 additions and 0 deletions

View file

@ -11,6 +11,7 @@ module CmdLine (
shutdown
) where
import System.IO
import System.IO.Error (try)
import System.Console.GetOpt
import Control.Monad.State (liftIO)
@ -30,6 +31,7 @@ import UUID
{- Runs the passed command line. -}
dispatch :: Git.Repo -> [String] -> [Command] -> [Option] -> String -> IO ()
dispatch gitrepo args cmds options header = do
forceUtf8
state <- Annex.new gitrepo allBackends
(actions, state') <- Annex.run state $ parseCmd args header cmds options
tryRun state' $ [startup, upgrade] ++ actions ++ [shutdown]