fish-shell/tests
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
..
checks Try to set LC_CTYPE to something UTF-8 capable (#8031) 2021-06-06 09:28:32 +02:00
pexpects tests/bind: Skip on Github macOS 2021-05-23 19:46:04 +02:00
test_functions Resurrect one last function 2020-03-17 21:58:49 +01:00
.gitignore tweak gitignore rules for *tests* directory 2017-02-20 20:29:43 -08:00
history_sample_bash history: Improve bash import check 2021-03-28 20:30:37 +02:00
history_sample_corrupt1
history_sample_fish_1_x Enforce that history items must end with trailing newlines 2021-05-10 14:23:07 -07:00
history_sample_fish_2_0 Enforce that history items must end with trailing newlines 2021-05-10 14:23:07 -07:00
interactive.config Remove some unused functions from the test harness 2020-11-15 09:17:23 +01:00
interactive.fish tests/bind: Skip on Github macOS 2021-05-23 19:46:04 +02:00
test_util.fish tests: Remove unused colordiff function 2021-01-01 14:18:17 +01:00
test.fish Cleanup test setup a bit 2020-11-15 09:17:23 +01:00