[Nix-dev] Set locale in a pure nix-shell
Shea Levy
shea at shealevy.com
Sat May 10 00:50:19 CEST 2014
Are there actually builds whose behavior changes based on LANG? Maybe
nix-shell can special-case it even for --pure?
On Fri, May 09, 2014 at 11:44:47PM +0400, Kirill Elagin wrote:
> 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.
> >
> >
> > --
> > Кирилл Елагин
> >
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
More information about the nix-dev
mailing list