-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
jupyter lab modifies the locale env variables like LANG #9672
Comments
Hi @alusiani, thanks for the report. Indeed this might be related to the i18n work on a PR on jupyterlab_server. @blink1073, how do your think we should handle this? |
@goanpeca while at it, these changes also made pyls fail when started by jupyter-lsp but only on Python 3.6 and only on Ubuntu https://github.com/krassowski/jupyterlab-lsp/issues/461 |
Hi @goanpeca, thanks for pointing to the above PR. I see that the LANG/ LANGUAGE env vars are determined by the jupyter lab settings. I was assuming that they should be driven by the user environment, but they are actually overridden. By setting the "language" in the jupyter lab advanced configuration editor to my env language (en_IE), I am able to solve my problem, and to get R correctly print unicode. I advise, regarding the code in the PR, to setup language = "en_US" rather than = "en", the former is a more sensible default for getting R to print OK unicode in jupyter lab cells. An even better strategy in my opinion is to get the language from the user env provided it is "sane" and only override it with the jupyter lab configuration if explicitly configured, without overriding by default. Cheers, |
As another datapoint, it also breaks extensions that run anything using click on Ubuntu:
This means that both of the python language servers that we (the Jupyter LSP team) support are broken under specific circumstances :( Downgrading to |
Closing as assuming the mentioned PR solved it. |
I don't believe the problem is cleanly solved - it is just not appear when using English any more. |
Thanks for the update @krassowski. So re-opening... |
I just got struck by this; quite annoying to setup a JupyterLab in French for my students. Any progress in sight? |
Looking at the documentation of python.gettext, the locale is inferred from the environment variable value:
So I would change the relationship to env var -> JLab language if the user does not have custom language setting in JLab. |
Great, thank you! |
Description
The env var LANG gets modified by jupyter lab for Python and R and possibly all kernels.
Reproduce
import os
print(os.environ['LANG'])
Expected behavior
The output should rather return my configured LANG = en_IE.UTF-8
This happens also in R, and in R it has the consequence that the locale is set to "C" (Sys.getlocale("LC_CTYPE")), localeToCharset() returns "ASCII" and all printed output in UTF-8 is decoded to ASCII text representation. If I use jupyter notebook instead, LANG does not get changed and R UTF-8 output is displayed correctly.
Context
Troubleshoot Output
Command Line Output
Browser Output
The text was updated successfully, but these errors were encountered: