当我运行perl时,我得到警告:

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

我该怎么解决呢?


当前回答

对于Debian用户,我在修改我的区域设置以更改机器的语言后遇到了这个问题。这就是我所做的:

修改. bashrc: 出口LANG = fr_FR。utf - 8 出口LC_ALL = fr_FR。utf - 8 取消注释行fr_FR。文件etc/locale中的UTF-8。Gen -> sudo locale-gen生成丢失的包 sudo update-locale sudo dpkg-reconfigure locale将我的locale配置为fr_FR。utf - 8 在etc/default/locale文件中添加额外的行: 语言= en_US。utf - 8 LC_ALL = en_US。utf - 8 LANG = en_US。utf - 8 LC_TYPE = en_US。utf - 8 重启我的电脑,一切正常

其他回答

如果您使用Mac OS X v10.10 (Yosemite)或以上版本来连接服务器Linux,您可以尝试这些步骤。

保持/etc/ssh/sshd-config文件原始 输入~/.bash_profile 出口LANG = " en_US " 出口LC_ALL = $朗。utf - 8 运行 dpkg-reconfigure地区 并选择“en_US”。utf - 8”

添加LC_ALL = " en_GB。Utf8”到/etc/environment并重新启动。这是所有。

每当我在最新的Kali Linux版本上运行Perl脚本(比如enum4linux)时,都会遇到这个问题。

kali@kali:~$ lsb_release -a
No LSB modules are available.
Distributor ID:    Kali
Description:    Kali GNU/Linux Rolling
Release:    2020.3
Codename:    kali-rolling
kali@kali:~$

例如,

kali@kali:~$ enum4linux
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_ADDRESS = "ms_MY.UTF-8",
    LC_NAME = "ms_MY.UTF-8",
    LC_MONETARY = "ms_MY.UTF-8",
    LC_PAPER = "ms_MY.UTF-8",
    LC_IDENTIFICATION = "ms_MY.UTF-8",
    LC_TELEPHONE = "ms_MY.UTF-8",
    LC_MEASUREMENT = "ms_MY.UTF-8",
    LC_TIME = "ms_MY.UTF-8",
    LC_NUMERIC = "ms_MY.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
enum4linux v0.8.9 (http://labs.portcullis.co.uk/application/enum4linux/)
Copyright (C) 2011 Mark Lowe (mrl@portcullis-security.com)

请看给出的警告信息。

perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

另外,注意LC_ALL = (unset)

解决办法很简单。你所要做的就是设置它。

export LC_ALL=en_US.UTF-8

例如,

kali@kali:~$ export LC_ALL=en_US.UTF-8
kali@kali:~$

问题解决了

kali@kali:~$ enum4linux
enum4linux v0.8.9 (http://labs.portcullis.co.uk/application/enum4linux/)
Copyright (C) 2011 Mark Lowe (mrl@portcullis-security.com)

对于永久解决方案,您可能希望将其添加到.bashrc文件中。

这在Ubuntu中很简单。您必须从头开始生成locale,从命令行运行以下命令:

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales

这将创建区域设置,然后重新配置它们。

以下是接受的答案:

LANG=C ssh hunter2。

LC_ALL=C ssh hunter2

在客户端,我成功了。