Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styx sets invalid value for LANG environment variable #16

Open
juliapath opened this issue Mar 1, 2019 · 0 comments
Open

styx sets invalid value for LANG environment variable #16

juliapath opened this issue Mar 1, 2019 · 0 comments

Comments

@juliapath
Copy link

juliapath commented Mar 1, 2019

How to reproduce

  1. Create a styx project
    $ mkdir test
    $ cd test
    $ cabal init -n
    ...
    $ cat <<here > styx.yaml
    local-packages:
      test:
        location: .
    here
    $ styx configure
    
  2. Watch the problems
    $ 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 en_US.UTF-8 is not listed in the available locales given by locale -a. The Cannot set ... error messages by locale -a are also due to the invalid value of LANG. Furthermore Haskell functions like getLine will assume the character encoding to be ASCI, causing them to throw exceptions on non ASCI characters.

Solutions

There are two possible solutions:

  1. Set LANG=C.UTF-8
  2. Add glibcLocales to buildInputs to make more locales available. This can be done easily as a workaround by adding glibcLocales to non-haskell-deps in styx.yaml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant