Hyper: "Setting locale failed" after update to 2.1.0-canary.2

Created on 18 Jun 2018  路  12Comments  路  Source: vercel/hyper

  • [x] I am on the latest Hyper.app version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate
  • OS version and name: macOS High Sierra 10.13.4
  • Hyper.app version: 2.1.0-canary.2
  • Link of a Gist with the contents of your .hyper.js: https://gist.github.com/timomeh/43d41685f55ee530018e91c45ee943b5
  • Relevant information from devtools _(CMD+ALT+I on macOS, CTRL+SHIFT+I elsewhere)_: N/A
  • The issue is reproducible in vanilla Hyper.app: If "vanilla" means without plugins, then yes, it can be reproduced. If "vanilla" means a non-canary version, then no, it cannot be reproduced.

Issue

After updating to 2.1.0-canary.2, I get the following message in my shell when starting a new session:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LC_ALL = (unset),
        LANG = "en_DE.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

This can't be reproduced in Terminal.app, and if I go back to 2.1.0-canary.1, the issue is gone.

It seems like #2913 could introduce this issue.

Bug Canary

Most helpful comment

Thanks for your response. For now I added LC_ALL and LANG to my zshrc, instead of sudo-ing around.

export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8

But I agree, setting a non-configured locale shouldn't happen.

All 12 comments

I am having the same problem. I think the only config that is different is that I am on macOS 10.13.5.

Can you execute locale command and attach the result?
Can you compare with Terminal.app output for the same command?

locale on Hyper:

> locale
LANG="en_DE.UTF-8"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

locale on Terminal.app:

> locale
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

ok I think this is related to your os configuration. You've certainly set english language with germany as Region. Thus detected locale is en_DE and it doesn't exist.

Several workaround exists (in your case, something like sudo echo en_DE.UTF-8 en_US.UTF-8 >> /usr/share/locale/locale.alias to define en_DE as an alias of en_US) but I think that we must validate locale before setting it.

Thanks for your response. For now I added LC_ALL and LANG to my zshrc, instead of sudo-ing around.

export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8

But I agree, setting a non-configured locale shouldn't happen.

Fixed for me with the same thing that @timomeh has done.

I am also having a problem related to this. In my case I get the following error when trying to source activate conda-env

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/Users/uname/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 98, in main
        return activator_main()
      File "/Users/uname/anaconda3/lib/python3.6/site-packages/conda/activate.py", line 584, in main
        print(activator.execute(), end='')
     UnicodeEncodeError: 'ascii' codec can't encode character '\u279c' in position 152: ordinal not in range(128)

I am on MacOS 10.13.5, also using ZSH. The output of locale in hyper.app is

LANG="en_US.UTF-8"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

and in Terminal.app

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

I can also reproduce the error with Perl mentioned above.

@pseudocubic can you confirm that your error doesn't happen on Terminal.app and on stable Hyper?

Yes, I can confirm that both Terminal.app and stable Hyper (2.0.0) both work fine, and even up to 2.1.0-canary.1 works, its only 2.1.0-canary.2 that this has become a problem

I can confirm this bug too (https://github.com/zeit/hyper/pull/2913#issuecomment-447627297). IMO setting lang to EN and having a differrent locale is not an os misconfiguration. We should somehow validate locale to prevent invalid default computed values like en_IR.UTF-8

@pi0 thank you for this PR on the right place!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cooperpellaton picture cooperpellaton  路  3Comments

alejandrofloresm picture alejandrofloresm  路  3Comments

dbkaplun picture dbkaplun  路  3Comments

anthonyettinger picture anthonyettinger  路  3Comments

ConstantinChirila picture ConstantinChirila  路  3Comments