$ nix-shell .styx/shell.nix --pure
nix$ echo $LANG
en_US.UTF-8
nix$ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.utf8
POSIX
nix$ ghci
Prelude> getLine
ä*** Exception: <stdin>: hGetLine: invalid argument (invalid byte sequence)
Note how
How to reproduce
en_US.UTF-8is not listed in the available locales given bylocale -a. TheCannot set ...error messages bylocale -aare also due to the invalid value ofLANG. Furthermore Haskell functions likegetLinewill assume the character encoding to be ASCI, causing them to throw exceptions on non ASCI characters.Solutions
There are two possible solutions:
LANG=C.UTF-8glibcLocalestobuildInputsto make more locales available. This can be done easily as a workaround by addingglibcLocalestonon-haskell-depsinstyx.yaml.