[Git][ghc/ghc][master] Elaborate comment on GHC_NO_UNICODE

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Sep 26 01:57:37 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
74132c2b by Andrew Lelechenko at 2023-09-25T21:56:54-04:00
Elaborate comment on GHC_NO_UNICODE

- - - - -


2 changed files:

- compiler/GHC/Driver/DynFlags.hs
- docs/users_guide/using.rst


Changes:

=====================================
compiler/GHC/Driver/DynFlags.hs
=====================================
@@ -495,6 +495,8 @@ class ContainsDynFlags t where
 initDynFlags :: DynFlags -> IO DynFlags
 initDynFlags dflags = do
  let
+ -- This is not bulletproof: we test that 'localeEncoding' is Unicode-capable,
+ -- but potentially 'hGetEncoding' 'stdout' might be different. Still good enough.
  canUseUnicode <- do let enc = localeEncoding
                          str = "‘’"
                      (withCString enc str $ \cstr ->


=====================================
docs/users_guide/using.rst
=====================================
@@ -1823,6 +1823,10 @@ GHC can also be configured using various environment variables.
 .. envvar:: GHC_NO_UNICODE
 
     When non-empty, disables Unicode diagnostics output regardless of locale settings.
+    GHC can usually determine that locale is not Unicode-capable and fallback to ASCII
+    automatically, but in some corner cases (e. g., when GHC output is redirected)
+    you might hit ``invalid argument (cannot encode character '\8216')``,
+    in which case do set ``GHC_NO_UNICODE``.
 
 .. envvar:: GHC_CHARENC
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/74132c2b0992849f83ef87c8a56ac3975738e767

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/74132c2b0992849f83ef87c8a56ac3975738e767
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230925/a23eeb77/attachment-0001.html>


More information about the ghc-commits mailing list