the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8

Apparently unset LC_ALL= was the issue, I checked

$ cat /etc/default/locale
LANG="en_US.utf8"
LANGUAGE="en_US:"

ensuring LC_ALL is missing, to fix it, I executed:

$ sudo update-locale LC_ALL=en_US.UTF-8

this command added LC_ALL to /etc/default/locale file:

$ cat /etc/default/locale
LANG="en_US.utf8"
LANGUAGE="en_US:"
LC_ALL=en_US.UTF-8

and error is gone.


I'm using erlang inside a docker container and the other solutions didn't cut it. The command update-locale may not be available inside a docker ubuntu container, so I've stole some code that installs it from https://hub.docker.com/r/voidlock/erlang/~/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

On centOS 7 the following worked for me:

localedef -c -f UTF-8 -i en_US en_US.UTF-8
export LC_ALL=en_US.UTF-8

Should work for most if not all RHEL distributions. Cheers!