[Nix-dev] Set locale in a pure nix-shell

Kirill Elagin kirelagin at gmail.com
Fri May 9 21:38:40 CEST 2014


`nix-shell --pure` resets locale to POSIX and this leads to issues with
unicode output.
For example:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% nix-shell --pure

[nix-shell:~/tmp/shell-test]$ cat test.py
print('かわいい')

[nix-shell:~/tmp/shell-test]$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    print('\u304b\u308f\u3044\u3044')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3:
ordinal not in range(128)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'd like to use some utf-8 locale (maybe `en_US.UTF-8` should be even used
by default?), but I have no idea what to do to make other locales available
inside a pure shell. Adding `glibcLocales` doesn't seem to make any
difference.


--
Кирилл Елагин
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140509/c7926ea7/attachment.html 


More information about the nix-dev mailing list