Change the default locale to C.UTF-8 on Linux

Change the default locale from en_US.UTF-8 to C.UTF-8 on Linux.
The former locale is not included by default in common Docker images,
whereas the latter locale is included by default.
The default locale remains en_US.UTF-8 on macOS.
This commit is contained in:
Shaun Jackman 2020-07-20 10:26:40 -07:00
parent 6b49d60954
commit ad735d6ed2

View File

@ -1,7 +1,19 @@
HOMEBREW_PROCESSOR="$(uname -m)"
HOMEBREW_SYSTEM="$(uname -s)"
case "$HOMEBREW_SYSTEM" in
Darwin) HOMEBREW_MACOS="1" ;;
Linux) HOMEBREW_LINUX="1" ;;
esac
# Force UTF-8 to avoid encoding issues for users with broken locale settings. # Force UTF-8 to avoid encoding issues for users with broken locale settings.
if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]] if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]]
then
if [[ -n "$HOMEBREW_MACOS" ]]
then then
export LC_ALL="en_US.UTF-8" export LC_ALL="en_US.UTF-8"
else
export LC_ALL="C.UTF-8"
fi
fi fi
# USER isn't always set so provide a fall back for `brew` and subprocesses. # USER isn't always set so provide a fall back for `brew` and subprocesses.
@ -87,13 +99,6 @@ then
odie "Cowardly refusing to continue at this prefix: $HOMEBREW_PREFIX" odie "Cowardly refusing to continue at this prefix: $HOMEBREW_PREFIX"
fi fi
HOMEBREW_PROCESSOR="$(uname -m)"
HOMEBREW_SYSTEM="$(uname -s)"
case "$HOMEBREW_SYSTEM" in
Darwin) HOMEBREW_MACOS="1" ;;
Linux) HOMEBREW_LINUX="1" ;;
esac
if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" && if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] && -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] &&
"$HOMEBREW_PREFIX/opt/curl/bin/curl" --version >/dev/null "$HOMEBREW_PREFIX/opt/curl/bin/curl" --version >/dev/null