From 7df0f0ab6e639517164c258065dff7f4fe5dc807 Mon Sep 17 00:00:00 2001 From: joshvera Date: Wed, 8 Feb 2017 18:23:10 -0500 Subject: [PATCH 1/2] Set LANG to utf8 if it's the empty string --- src/Diffing.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Diffing.hs b/src/Diffing.hs index 75499390f..bbedd5be6 100644 --- a/src/Diffing.hs +++ b/src/Diffing.hs @@ -113,7 +113,11 @@ writeToOutput output text = case output of Nothing -> do lang <- lookupEnv "LANG" - if isNothing lang then IO.hSetEncoding IO.stdout IO.utf8 else pure () + case lang of + -- If LANG is set and isn't the empty string, leave the encoding. + Just x | x /= "" -> pure () + -- Otherwise default to utf8. + _ -> IO.hSetEncoding IO.stdout IO.utf8 TextIO.hPutStrLn IO.stdout text Just path -> do isDir <- doesDirectoryExist path From 30029f364005267deedcc40a29635fe4e0a687ea Mon Sep 17 00:00:00 2001 From: joshvera Date: Wed, 8 Feb 2017 18:28:43 -0500 Subject: [PATCH 2/2] no tabs --- src/Diffing.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Diffing.hs b/src/Diffing.hs index bbedd5be6..8d5344186 100644 --- a/src/Diffing.hs +++ b/src/Diffing.hs @@ -114,10 +114,10 @@ writeToOutput output text = Nothing -> do lang <- lookupEnv "LANG" case lang of - -- If LANG is set and isn't the empty string, leave the encoding. - Just x | x /= "" -> pure () - -- Otherwise default to utf8. - _ -> IO.hSetEncoding IO.stdout IO.utf8 + -- If LANG is set and isn't the empty string, leave the encoding. + Just x | x /= "" -> pure () + -- Otherwise default to utf8. + _ -> IO.hSetEncoding IO.stdout IO.utf8 TextIO.hPutStrLn IO.stdout text Just path -> do isDir <- doesDirectoryExist path