Original: https://www.cnblogs.com/hooly/p/8615384.htmlCopyright: Attribution to the original author!!!
View the character sets that are currently used by default in the system:
# locale
In the Redhat/centos system, the recording system default language file is/etc/sysconfig/i18n, if the default installation is the Chinese system, i18n content is as follows:
lang="zh_cn. UTF-8" sysfont="latarcyrheb-sun16" supported=" ZH_CN. Utf-8:zh_cn:zh"
Where lang variable is the abbreviation of language, a slightly English-based user can see that the variable is the default language of the system, that is, the system's menu, the program's toolbar language, input method default language and so on. Sysfont is the abbreviation for system font, which determines which font is used by default. The supported variable determines the language that the system supports, i.e. the language that the system can display. It is necessary to note that since computers originate in English-speaking countries, English is always supported by default, regardless of the font you use, and regardless of the typeface, the text is included.
So how to display Chinese?
1. The system must install the Chinese language pack before it can be
# yum-y Groupinstall Chinese-support
2. Only language packs are not available, we have to set the corresponding character sets
2.1 Temporary entry into force:
# Export lang= "ZH_CN. UTF-8 " # set to Chinese # export lang=" en_US. UTF-8 " # set to English
2.2 Permanently effective, edit/etc/sysconfig/i18n (preferably reboot)
Lang= "ZH_CN. UTF-8 "
2.3 Or, edit the/etc/profile configuration file and add the following line
Export lang= "ZH_CN. UTF-8 "
Reload:
# . /etc/profile
To view the current character set:
# echo $LANG
After the above settings, the character set should be set.
View:
Report:
After the character set is set, the Web project download file is garbled and can be changed in Tomcat file.encoding,catalina.sh (Catalina.bat in Windows)-dfile.encoding=utf-8
Of course, you also need to set UTF-8 encoding in Server.xml:
Linux does not show Chinese