How to solve this warning being prompted every time I execute Elixir code or enter iex
?
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)
$ locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_US.utf8 LANGUAGE=en_US: LC_CTYPE=UTF-8 LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_PAPER="en_US.utf8" LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL= $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With