Recently encountered some of the application of dry run in the Linux system under the garbled problem, the final check are found to be the client's Linux system default coding settings caused by the incorrect, this cause of garbled phenomenon is generally written in the program inside of the letter can be normal display, But the Chinese characters that are fetched from the database or read from the program will appear garbled.
The following is a description of the Linux system because the coding settings incorrectly cause the dry report to use garbled problem solution.
First step: Check the Linux system code.
Check the Linux system code to determine if the system supports Chinese. In the Linux system terminal to enter the command: locale, you will see the printed system encoding information. If the printed information is as follows, the system's encoding does not support Chinese:
Lang=en_us. UTF-8
Lc_ctype= "en_US. Utf-8″
Lc_numeric= "en_US. Utf-8″
Lc_time= "en_US. Utf-8″
Lc_collate= "en_US. Utf-8″
Lc_monetary= "en_US. Utf-8″
Lc_messages= "en_US. Utf-8″
Lc_paper= "en_US. Utf-8″
Lc_name= "en_US. Utf-8″
Lc_address= "en_US. Utf-8″
Lc_telephone= "en_US. Utf-8″
Lc_measurement= "en_US. Utf-8″
Lc_identification= "en_US. Utf-8″
Step Two: Modify the system default encoding settings
If you find that the system code does not support Chinese, then you need to modify the system code to support Chinese, so that the drying report in Chinese in the application will not garbled.
The method for modifying the system encoding is as follows:
/etc/sysconfig/i18n
Controls the system font settings. The language variables are used in/etc/profile.d/lang.sh. An example i18n file:
Lang= "en_US. Gb18030″
Language= "en_US. Gb18030:en_us. Gb2312:en_us "
Supported= "en_US. GB18030:en_US:en:en_US. Utf-8:en_us:en "
Sysfont= "Lat0-sun16″
The above is the system's default character set is in English if you want to set the character set to support Chinese, you can change the system's default character set by setting this file.
Alternatively, the declaration of the PATH variable can be added to the user's environment variable or user's environment variable file:
Declared in the system's preprocessing file, which works for the entire system:
#vi/etc/profile
Add at end of file
Lc_all= "ZH_CN. GBK "
Export lang= "ZH_CN. GBK "
Declared in a user's preprocessing file to work with a single user:
#vi/root/.bash_profile
Add at end of file
Export Lc_all= "ZH_CN. GBK "
Export lang= "ZH_CN. GBK "
The above configuration restarts the server for the changes to take effect.
Step three: View the modified system default encoding.
Through the above steps and then restart the computer, and then enter the command in the terminal: locale, and then you will see the system's character set information changes
This system code to support Chinese, after the above changes, because the system default code does not support the Chinese-made garbled can be successfully resolved.
The above is a small series for everyone to bring the Linux because the system coding problems caused by the fast solution of garbled all content, I hope that we support cloud Habitat Community ~