summaryrefslogtreecommitdiff
path: root/Messages.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Messages.hs')
-rw-r--r--Messages.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Messages.hs b/Messages.hs
index 90857280a..83b3ecf23 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -64,3 +64,12 @@ indent s = join "\n" $ map (\l -> " " ++ l) $ lines s
- non-decoded form. -}
filePathToString :: FilePath -> String
filePathToString = if SysConfig.unicodefilepath then id else UTF8.decodeString
+
+{- Workaround to avoid crashes displaying filenames containing
+ - characters > 255 in non-utf8 locales. Force encodings to utf-8,
+ - even though this may mean some characters in the encoding
+ - are mangled. -}
+forceUtf8 :: IO ()
+forceUtf8 = do
+ hSetEncoding stdout utf8
+ hSetEncoding stderr utf8