Terminal

UTF-8 字元未在控制台上正確列印

  • July 15, 2021

我見過一些與此類似的問題,但我無法使用這些解決方案來幫助我。那麼,我的問題是什麼?,我有一個包含字元,,,等的文件ç……ã但是當我使用,,,等à時它們不會在終端上列印……終端和我的字型可以並且做支持這些字元。awk``cat``grep

我的語言環境設置為en_GB.UTF-8,命令的輸出locale是:

LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8

我找到了解決辦法!我只需要將文件轉換UTF-8ISO-8859.

查看文件的目前編碼:file <path-to-file> 然後,將所述文件轉換為 UTF-8:iconv -f ISO-8859-15 -t UTF-8 >> <path-to-converted-file>

這應該解決“問題”;

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