summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/main/DynFlags.hs6
-rw-r--r--docs/users_guide/using.rst11
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 429857ad62..f809bc330f 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -1894,6 +1894,10 @@ initDynFlags dflags = do
do str' <- peekCString enc cstr
return (str == str'))
`catchIOError` \_ -> return False
+ maybeGhcNoUnicodeEnv <- lookupEnv "GHC_NO_UNICODE"
+ let adjustNoUnicode (Just _) = False
+ adjustNoUnicode Nothing = True
+ let useUnicode' = (adjustNoUnicode maybeGhcNoUnicodeEnv) && canUseUnicode
canUseColor <- stderrSupportsAnsiColors
maybeGhcColorsEnv <- lookupEnv "GHC_COLORS"
maybeGhcColoursEnv <- lookupEnv "GHC_COLOURS"
@@ -1909,7 +1913,7 @@ initDynFlags dflags = do
dirsToClean = refDirsToClean,
generatedDumps = refGeneratedDumps,
nextWrapperNum = wrapperNum,
- useUnicode = canUseUnicode,
+ useUnicode = useUnicode',
useColor = useColor',
canUseColor = canUseColor,
colScheme = colScheme',
diff --git a/docs/users_guide/using.rst b/docs/users_guide/using.rst
index 8462a87cd8..d97e3bd2e8 100644
--- a/docs/users_guide/using.rst
+++ b/docs/users_guide/using.rst
@@ -1153,3 +1153,14 @@ Some flags only make sense for a particular use case.
included. This option can be used to specify the path to the
``ghcversions.h`` file to be included. This is primarily intended to be
used by GHC's build system.
+
+Other environment variables
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. index::
+ single: environment variables
+
+GHC can also be configured using environment variables. Currently the only
+variable it supports is ``GHC_NO_UNICODE``, which, when set, disables Unicode
+output regardless of locale settings. ``GHC_NO_UNICODE`` can be set to anything
++(event an empty string) to trigger this behaviour.