I just ran into a similar problem.
The solution was to install the expected language package :
yum install glibc-langpack-en.x86_64
Note: it is on CentOS 8, but I guess the solution would be similar on CentOS 7.
The file /etc/enviroment has nothing to do with system locale and you have to edit LC_COLLATE=C.UTF-8. LC_ALL=C was back in the days but you using a rolling release.
When using sysvinit or openrc or something similar ...
your locales are created with locale-gen and /etc/locale.gen then passed to /etc/locale.conf and /etc/env.d/02locale
Here is an example ...
incomplete but functional solution:
fist check the output of $ locale
then read the manuals of these packages and install if suited:
locale, localedef, localehelper, locales-all, and localepurge
I only installed locales-all and set this in my .bashrc
The following 3 methods all seem to work in Ubuntu:
sudo update-locale "LANG=en_GB.UTF-8"; sudo locale-gen --purge "en_GB.UTF-8"; sudo dpkg-reconfigure --frontend noninteractive locales
echo "en_GB.UTF-8" | sudo tee -a /etc/locale.gen; sudo locale-gen
sudo update-locale LANG=en_GB.UTF-8
However, after doing this, when I type ...
On a GNU system, appending NULs to non-alphas may help:
$ ls | sed 's/[^[:alpha:]]/&\x0/g' | sort | tr -d '\0'
That assumes file names don't contain newline characters. Generally, you can't sort lists of file names with sort as file names can very well be made of several lines themselves.
You could replace the newlines within filenames with / ...
I fixed this with a few steps for some Raspberry Pis that I was sshing to.
I commented out en_GB.UTF-8 in /etc/locale.gen and uncommented en_US.UTF-8.
I added the lines LC_CTYPE=en_US.UTF-8 and LC_ALL=en_US.UTF-8 to /etc/default/locale. You may need to add more lines like this such as LC_MESSAGES=en_US.UTF-8.
I ran export LC_ALL=en_US.UTF-8.
Finally, I ran ...