Environment-Variables

為什麼不能在語言環境中設置 LC_ALL 的值?

  • February 16, 2020

我本地電腦中的作業系統。

uname -a
Linux debian 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3 (2019-09-02) x86_64 GNU/Linux

我目前的語言環境。

locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

我想設置LC_ALL=C.UTF-8

sudo localectl set-locale LC_ALL=C.UTF-8
Failed to issue method call: Invalid Locale data.

嘗試設置 LC_ALL=en_US.UTF-8

sudo localectl set-locale  LC_ALL=en_US.UTF-8 
Failed to issue method call: Invalid Locale data.

的預設值LC_ALL只能是空白(空)?

如 Arch Linux wiki Locale 中所述,LC_ALL:故障排除

LC_ALL is the only LC_* variable which cannot be set in locale.conf files: it is meant to be used only for testing or troubleshooting purposes, for example in /etc/profile.

locale.conf — locale settings 的配置文件中,在 systemd 文件中聲明:

Note that LC_ALL may not be configured in this file.

引用自:https://unix.stackexchange.com/questions/567826