LC_ALL set to invalid value

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 9.3.4
  • Operating System:
    • Arch Linux
  • Last Known Working Electron version:
    • 9.3.3

Expected Behavior

❱ echo lang: $LANG lc_all: $LC_ALL
lang: en_US.UTF-8 lc_all:
❱ electron9 -i                    
> process.env.LC_ALL
undefined

Actual Behavior

❱ echo lang: $LANG lc_all: $LC_ALL
lang: en_US.UTF-8 lc_all:
❱ electron9 -i                    
> process.env.LC_ALL
'en_US'

en_US is not a valid locale—it has to be en_US.UTF-8, however, Electron overrides this, even if --lang=en_US.UTF-8 is passed or LC_ALL is set correctly when invoking Electron. With this invalid value, many C programs fail to run.

To Reproduce

Run the above commands.

Additional Information

Problem introduced in #26242

Author: Fantashit

2 thoughts on “LC_ALL set to invalid value

  1. It broke VSCode terminal for some reason, locale in the terminal is reporting strange pt-BR nonexistent locale. My locale is actually pt_BR.UTF-8 (in any other terminal).

  2. Why is Electron playing with the locale environment variables? That is typically a system-wide setting, and Electron shouldn’t be overriding it for itself. Definitely not on Linux. There is no guarantee that whatever locale Electron sets has been generated on the system. You can only use languages listed in locale -a. So you can’t blindly set the locale variable.

    Note also that locale names are also system-specific.

    Portability Note: With the notable exception of the standard locale names ‘C’ and ‘POSIX’, locale names are system-specific.

Comments are closed.