fish-shell/doc_src
Fabian Homborg 046db09f90
Try to set LC_CTYPE to something UTF-8 capable (#8031)
* Try to set LC_CTYPE to something UTF-8 capable

When fish is started with LC_CTYPE=C (even just effectively, often via
LC_ALL=C!), it's basically broken. There's no way to handle non-ASCII
characters with a C locale unless we want to write our
locale-independent replacements for all of the system functions.

Since we're not going to do that, let's try to find *some locale* for
LC_CTYPE.

We already do that in __fish_setlocale, but that's

- a bit of a weird thing that reads unstandardized system
  configuration files
- allows setting locale to C explicitly

So it's still easily possible to end up in a broken configuration.

Now, the issue with this is that there is (AFAICT) no portable way to
get a list of all allowed locales and C.UTF-8 is not standardized, so
we have no one locale to fall back on and are forced to try a few. The
list we have here is quite arbitrary, but it's a start.

Python does something similar and only tries C.UTF-8, C.utf8 and
"UTF-8".

Once C.UTF-8 is (hopefully) standardized, that will just start
working (tm).

Note that we do not *export* the fixed LC_CTYPE variable, so external
programs still have to deal with the C locale, but we have no real
business messing with the user's environment.

To turn it off: $fish_allow_singlebyte_locale, if set to something true (like "1"),
will re-run the locale initialization and skip the bit where we force
LC_CTYPE to be utf8-capable.

This is mainly used in our tests, but might also be useful if people
are trying to do something weird.
2021-06-06 09:28:32 +02:00
..
cmds docs: Don't speak of "initialization files" 2021-05-28 20:49:57 +02:00
python_docs_theme Make background a bit more blue, brighter 2021-06-05 11:17:53 +02:00
commands.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
completions.rst docs: Replace all internal links with :ref:s 2021-03-26 19:32:14 +01:00
conf.py docs: Unbreak sphinx' man directories 2021-05-13 18:20:47 +02:00
design.rst Make rationale spacing consistent 2020-10-12 20:25:35 +02:00
faq.rst docs: Don't speak of "initialization files" 2021-05-28 20:49:57 +02:00
fish_for_bash_users.rst docs: Add a section on subshells to fish-for-bash-users 2021-05-22 17:30:45 +02:00
fish_indent_lexer.py Highlight keywords differently 2021-02-07 21:18:51 +01:00
index.rst docs: Don't speak of "initialization files" 2021-05-28 20:49:57 +02:00
interactive.rst Document vi-visual mode keys 2021-06-03 10:03:43 +02:00
language.rst Try to set LC_CTYPE to something UTF-8 capable (#8031) 2021-06-06 09:28:32 +02:00
license.rst Update copyright years 2021-05-03 13:12:11 +02:00
relnotes.rst docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
tutorial.rst docs: Some rewording to the tutorial 2021-05-28 20:49:57 +02:00