$ locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=en_US
一切都很好:
$ man du
DU(1) User Commands DU(1)
NAME
du - estimate file space usage
SYNOPSIS
du [OPTION]... [FILE]...
DESCRIPTION
Summarize disk usage of each FILE, recursively for directories.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
write counts for all files, not just directories
--apparent-size
print apparent sizes, rather than disk usage; although the appar-
ent size is usually smaller, it may be larger due to holes in
('sparse') files, internal fragmentation, indirect blocks, and
the like
-B, --block-size=SIZE use SIZE-byte blocks
当我更改LC_ALL
时:
$ LC_ALL=en_US.utf8
$ locale
LANG=en_US
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8
现在变得糟糕了:
$ man du
DU(1) User Commands DU(1)
NAME
du - estimate file space usage
SYNOPSIS
du [OPTION]... [FILE]...
DESCRIPTION
Summarize disk usage of each FILE, recursively for directories.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
write counts for all files, not just directories
--apparent-size
print apparent sizes, rather than disk usage; although the appar-
ent size is usually smaller, it may be larger due to holes in
(<E2><80><98>sparse<E2><80><99>) files, internal fragmentation, indirect blocks, and
the like
-B, --block-size=SIZE use SIZE-byte blocks
'
字符变为<E2><80><98>
,为什么?
答案 0 :(得分:1)
通过将您的语言环境设置为UTF-8,您已告诉shell和其他程序将以UTF-8编码的文本输出到终端。但是,您的终端不理解UTF-8,因此显示3字节序列而不是U + 2018的实际符号,“左单引号”。您需要将终端仿真器配置为接受UTF-8输出,或者找到一个输出。