Warning: the VM is running with native name encoding of latin1

On FreeBSD 12 I have this warning:


warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)

However, everything had been set up:



$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_ALL=

What gives?

Warning when running which command exactly?

When launching a Phoenix app.

Why your LANG value without quotes? May be because of that

1 Like

I’m facing similar error, but inside docker container.

When the image is built, I get following values for locale command inside the container

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

I have added following command to set the locale in Dockerfile

 apt-get update && apt-get install -y --no-install-recommends locales \
&& export LANG=en_US.UTF-8 \
&& echo $LANG UTF-8 > /etc/locale.gen \
&& locale-gen \
&& update-locale LANG=$LANG \

Above commands only set the locale when I run it from container. It does not run when added to Dockerfile.

I had a similar issue, which was caused by setting the locale in the wrong stage in a multi stage build. If you have a multi stage build, make sure you are setting the locale in the final container that the release gets copied into.

1 Like