Skip to content

Commit

Permalink
docker: Fix locale to C.UTF-8
Browse files Browse the repository at this point in the history
The docker images usually don't have locales configured, because it's
hard to know which locale should be really used. Because of this, it's
safer to just specify the character set, and use the "C" locale, which
is present everywhere.
  • Loading branch information
1 parent 2bbfe45 commit f60fd6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/docker/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e

# Environment variables to export (Travis-defined + BEAVER_DOCKER_VARS)
env_vars="$(printenv -0 | sed -zn 's/^\([^=]\+\)=.*$/\1\n/p')"
travis_vars="USER HOME LANG LC_ALL DEBIAN_FRONTEND \
travis_vars="USER HOME DEBIAN_FRONTEND \
RAILS_ENV RACK_ENV MERB_ENV JRUBY_OPTS JAVA_HOME \
CI CONTINUOUS_INTEGRATION $(echo "$env_vars" | grep '^TRAVIS')"
beaver_vars="DIST BINTRAY_USER BINTRAY_KEY"
Expand All @@ -20,4 +20,4 @@ uid="$(id -u)"
# Run the actual command
set -x
docker run -ti --rm -v "$HOME:$HOME" -v "$PWD:$PWD" -w "$PWD" -u "$uid" \
$docker_env_var_args beaver "$@"
-e LANG=C.UTF-8 -e LC_ALL=C.UTF-8 $docker_env_var_args beaver "$@"
5 changes: 5 additions & 0 deletions test/hello
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ if test -n "$DIST"
then
test "$DIST" = "$(lsb_release -cs)"
fi

# Some encoding tests
test "$LC_ALL" = "C.UTF-8"
test "$LANG" = "C.UTF-8"
python3 -c 'import sys; assert sys.stdout.encoding == "UTF-8"'

0 comments on commit f60fd6c

Please sign in to comment.