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

Kirill Elagin kirelagin at gmail.com
Fri May 9 21:44:47 CEST 2014


Ok, as it always happens, immediately after sending the message I realised
that I need `LOCALE_ARCHIVE` in the environment.
So `glibcLocales` is no needed at all, it's just enough to point
`LOCALE_ARCHIVE` to the system locale archive.

But the question remains. I feel that setting locale by default to
something more reasonable than POSIX might be a good idea…


--
Кирилл Елагин


On Fri, May 9, 2014 at 11:38 PM, Kirill Elagin <kirelagin at gmail.com> wrote:

> `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/325c3a7a/attachment.html 


More information about the nix-dev mailing list