Phenomenon
After installing kubuntu 20.04 system and Sogou input method, I found that neither kconsole nor deepin-terminal can correctly input and display Chinese
solve
The factory configuration of kubuntu 20.04 does not use the Chinese character set, resulting in garbled Chinese characters
View local (ie local) related environment variables
$ locale
LANG=C
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC=zh_CN.UTF-8
LC_TIME=zh_CN.UTF-8
LC_COLLATE="C"
LC_MONETARY=zh_CN.UTF-8
LC_MESSAGES="C"
LC_PAPER=zh_CN.UTF-8
LC_NAME=zh_CN.UTF-8
LC_ADDRESS=zh_CN.UTF-8
LC_TELEPHONE=zh_CN.UTF-8
LC_MEASUREMENT=zh_CN.UTF-8
LC_IDENTIFICATION=zh_CN.UTF-8
LC_ALL=
Set the correct Chinese environment:
- Pure Chinese system
Set environment variables LC_ALL=zh_CN.UTF-8
, other environment variables starting with LC are set tozh_CN.UTF-8
- Chinese can be input, but system information such as menus and titles are displayed in English
Only need to set the character set of the systemLC_CTYPE=zh_CN.UTF-8
You only need ~/.profile
to ~/.bashrc
add in or export LC_CTYPE="zh_CN.utf8"
, and you can enter Chinese normally after restarting
Of course, the following can also be set individually:
- number format
LC_NUMERIC
- time display format
LC_TIME
- Currency Unit
LC_MONETARY
- Unit of measure
LC_MEASUREMENT
But these can be found in the system settings interface
In addition, similar LANG
to LC_ALL
the function , set the default value of other LC beginning variables, but the priority is lower and can be LC_ALL
overwritten
Priority: LC_ALL
> LC_*
>LANG
LANG - Specifies the default locale for all unset locale variables
LANGUAGE - Most programs use this for the language of its interface
View all available values
$ locale -a
C
C.UTF-8
POSIX
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
zh_CN.utf8