add a check for not utf-8 console
This commit is contained in:
parent
3d49258e5b
commit
fb78107f85
1 changed files with 9 additions and 11 deletions
20
Messages.hs
20
Messages.hs
|
@ -119,18 +119,16 @@ showHeader h = handle q $
|
||||||
showRaw :: String -> Annex ()
|
showRaw :: String -> Annex ()
|
||||||
showRaw s = handle q $ putStrLn s
|
showRaw s = handle q $ putStrLn s
|
||||||
|
|
||||||
{- By default, haskell honors the user's locale in its output to stdout
|
{- This check is done because the code assumes filenames are utf8 encoded,
|
||||||
- and stderr. While that's great for proper unicode support, for git-annex
|
- using decodeUtf8 and Codec.Binary.UTF8.String.encodeString. So if
|
||||||
- all that's really needed is the ability to display simple messages
|
- run in a non unicode locale, it will crash or worse, possibly operate
|
||||||
- (currently untranslated), and importantly, to display filenames exactly
|
- on the wrong file.
|
||||||
- as they are written on disk, no matter what their encoding. So, force
|
-}
|
||||||
- raw mode.
|
|
||||||
-
|
|
||||||
- NB: Once git-annex gets localized, this will need a rethink. -}
|
|
||||||
setupConsole :: IO ()
|
setupConsole :: IO ()
|
||||||
setupConsole = return ()
|
setupConsole
|
||||||
--hSetBinaryMode stdout True
|
| show localeEncoding == show utf8 = return ()
|
||||||
--hSetBinaryMode stderr True
|
| otherwise = error $
|
||||||
|
"Sorry, only UTF-8 locales are currently supported."
|
||||||
|
|
||||||
handle :: IO () -> IO () -> Annex ()
|
handle :: IO () -> IO () -> Annex ()
|
||||||
handle json normal = Annex.getState Annex.output >>= go
|
handle json normal = Annex.getState Annex.output >>= go
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue