From ad735d6ed2b4a80483dea3486660560fedb44a2f Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Mon, 20 Jul 2020 10:26:40 -0700 Subject: [PATCH] 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. --- Library/Homebrew/brew.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index f53ee7ddb2..f0bafb577e 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -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. if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]] then - export LC_ALL="en_US.UTF-8" + if [[ -n "$HOMEBREW_MACOS" ]] + then + export LC_ALL="en_US.UTF-8" + else + export LC_ALL="C.UTF-8" + fi fi # 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" 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" && -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] && "$HOMEBREW_PREFIX/opt/curl/bin/curl" --version >/dev/null