2014-06-06 75 views
-1
$ 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 

The '字符變成<E2><80><98>,爲什麼?

回答

1

通過將您的語言環境設置爲UTF-8,您告訴shell和其他程序將以UTF-8編碼的文本輸出到終端。但是,您的終端不理解UTF-8,因此顯示的是3字節序列,而不是U + 2018的實際符號「左單引號」。您需要配置您的終端仿真程序以接受UTF-8輸出,或者找到一個可以執行的操作。

+0

我正在使用SecureCRT,並且已將它的字符編碼配置爲UTF-8,但錯誤仍然存​​在。如果我在'.utf8'中使用'en_US',將使用什麼編碼? –

相關問題