brew.sh: handle Linux systems with no 'locale'

This commit is contained in:
Maxim Belkin 2020-08-17 15:24:18 +00:00
parent d33691dcdb
commit b8d21dcf60

View File

@ -6,15 +6,18 @@ case "$HOMEBREW_SYSTEM" in
esac
# Force UTF-8 to avoid encoding issues for users with broken locale settings.
if ! command -v locale >/dev/null
if [[ -n "$HOMEBREW_MACOS" ]]
then
export LC_ALL=C
elif [[ "$(locale charmap)" != "UTF-8" ]]
then
if [[ -n "$HOMEBREW_MACOS" ]]
if [[ "$(locale charmap)" != "UTF-8" ]]
then
export LC_ALL="en_US.UTF-8"
else
fi
else
if ! command -v locale >/dev/null
then
export LC_ALL=C
elif [[ "$(locale charmap)" != "UTF-8" ]]
then
locales=$(locale -a)
c_utf_regex='\bC\.(utf8|UTF-8)\b'
en_us_regex='\ben_US\.(utf8|UTF-8)\b'