Resolve the Chinese display garbled after SSH terminal CentOS

Source: Internet
Author: User
Tags i18n locale pack ssh sublime text
Today, help our classmates to deal with the Chinese display garbled problem. This is a problem for domestic Linux users, because most Linux distributions are English-speaking, and English is better than Chinese in generality and stability, and a little bit less for all kinds of strange bugs. Therefore, it is strongly recommended to use the English system.
We know that our operating system is not the Chinese version and the English version, whether it is Windows or Linux, the system is distributed around the world are the same kernel, the system is presented to us in English or Chinese, depending on your choice of language pack. People from different countries choose their own country's language packs when they install and use them, the language in the application is not written to death, it invokes the relevant language according to the system settings, so an application is written without modification, and users from different countries around the world can use it in their native language interface. This is the so-called internationalization (internationalization), referred to as i18n. This is also the future development trend of software.
So, if I have different language packs and different fonts installed in the system, how can the system judge the language interface I want and invoke the relevant font? Those files and variables in the system are controlling these.
You can use the locale command to view the character set used by default for the current system

# locale
In the Redhat/centos system, the recording system defaults to the language of the 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 "
The lang variable is the abbreviation of language, a little English based users can see that the variable is the default language of the system, that is, the system's menu, Program toolbar language, input method default language. 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, that is, the language the system can display. It should be explained that, since the computer originated in the English-speaking country, the English language is always supported by default regardless of what you set it to, and the total of the English text is included in whatever font you use.

So how do you show Chinese?
1. The system must install the Chinese language pack.

# yum-y Groupinstall Chinese-support
2, only the language pack is not enough, we have to set the corresponding character set

# # Temporary Effective
# export lang= ' ZH_CN. UTF-8 "# Set to Chinese
# export lang= ' en_US. UTF-8 "# Set to English, I prefer this export lang=c

# # permanently effective, edit/etc/sysconfig/i18n (preferably reboot)
Lang= "ZH_CN. UTF-8 "

# # or, edit the/etc/profile configuration file, add the following line
Export lang= "ZH_CN. UTF-8 "
# Reload
# . /etc/profile

# # View the current character set
# echo $LANG
OK, after the setting above, it should be able to display Chinese on the terminal.
3, SSH remote terminal garbled
If the SSH terminal is still garbled, then we also need to set the coding of the terminal software.
Xshell:


SECURECRT:


4, if the terminal or Chinese garbled to do.
Set up the SSH software and select a font that supports Chinese.

Linux <---> Windows need to modify files between each other and then garbled.
Copy up often found in Chinese display garbled. The reason is that the default file format in Windows is GBK (gb2312), and Linux is generally UTF-8. The more cumbersome approach is to use the program to convert content to UTF-8 encoded format under Windows, but it is rather cumbersome and encounters a file to turn back. Here's how to solve this problem once and for all in Linux, look at the encoding of the file and how to encode the file.

The best way to avoid these problems is to unify the code. For text files, all are saved in the UTF8 format, and don't use Word, Notepad, sublime text, or notepad++ under Windows.




Http://www.centoscn.com/CentosBug/osbug/2014/0919/3776.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.