What happens when running Elixir application in other locale than UTF-8

Hi,

We are receiving this message but our system is already running fi_FI.utf8

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)

What happens if the Elixir application is not running UTF-8? I haven’t found any good answer to this question.

We are using Yocto Linux which is somewhat different to normal Linux operating systems so this might cause some confusion to Elixir when it detects what locale is used.

1 Like

If the system encoding is not UTF8 then in- and output might become malformed.

Elixir will by default interprete the incoming bytes as UTF8 and it will also print its output under the assumption that the “target” knows how to deal with UTF8.

If though your system is Latin1 (or whatever) then umlauts will probably appear malformed.

And even though I don’t know yocto, the locale is also a common issue on nixOS, and we usually mitigate by forcing LOCALE_ARCHIVE to point to a certain version of the glibc local archive. Sometimes we also set LANG for the build to en_US.utf8 or another valid value, as the build system would assume “C” otherwise.

Perhaps those hints can help you for yocto as well?

3 Likes