on master help sign in
Add note about implementation of supportUnicode
commit69ae88cf9fde02966005af57396a238b50eee357 authorKen Micklas <ken.micklas@obsidian.systems> dateFri 22 Mar 2019, 15:11 (8 years ago) parent51bf32f
1 file changed+5
lib/cliapp/src/Obelisk/CliApp/Spinner.hs+5
lib/cliapp/src/Obelisk/CliApp/Spinner.hs+5
@@ -120,6 +120,11 @@ withSpinner' msg mkTrail action = do
120120 Just enc | supportUnicode enc -> coloredSpinner defaultSpinnerTheme
121121 _ -> coloredSpinner minimalSpinnerTheme
122122
123+-- | Conservatively determines whether the encoding supports Unicode.
124+--
125+-- Currently this uses a whitelist of known-to-work encodings. In principle it
126+-- could test dynamically by opening a file with this encoding, but it doesn't
127+-- look like base exposes any way to determine this in a pure fashion.
123128supportUnicode :: TextEncoding -> Bool
124129supportUnicode enc = any ((textEncodingName enc ==) . textEncodingName)
125130 [ utf8