How to solve Chinese garbled characters using putty in Linux

Source: Internet
Author: User
Tags i18n ssh secure shell

Putty Chinese garbled Solution
Method 1: Open the putty main program, select window-> appearance-> font settings-> change..., select the fixedsys font, and select chinese_gb2312 as the character set. In window-> appearance-> translation, modify ed data assumed to be in which character set, change use font encoding to UTF-8 if frequently used, save these settings in session. open putty now. After logon is successful, enter: Export in Shell
Lc_all = 'zh _ Cn. utf8' Method 2: edit/etc/sysconfig/i18n to change the 1st sentence "lang =" zh_CN.UTF-8 "to" lang = "zh_cn.gb18030 "", save and log on again.

1. garbled console Terminal
Add the following content to the last line of the/etc/profile file:
Export lc_all = "zh_cn.gb18030"
2. garbled XWindow Terminal
Add the following content to the last line of the/etc/sysconfig/i18n file:
Export lc_all = "zh_cn.gb18030" +
**************************
Garbled characters can be divided into two situations:
1. Terminal garbled characters (pure Shell Interface)
VI/etc/profile
Export lc_all = "zh_cn.gb18030: zh_cn.gb2312: zh_cn.gbk: zh_cn: en_US.UTF-8: en_us: EN: Zh: zh_tw: zh_cn.big5"
Save and exit, reboot system ..
2. garbled characters in X-window (graphic interface)
VI/etc/sysconfig/i18n
Lang = "zh_cn.gb18030: zh_cn.gb2312: zh_cn.gbk: zh_cn: en_US.UTF-8: en_us: EN: Zh: zh_tw: zh_cn.big5"
Language = "zh_cn.gb18030: zh_cn.gb2312: zh_cn.gbk: zh_cn: en_US.UTF-8: en_us: EN: Zh: zh_tw: zh_cn.big5"
Save reboot...
*********************
A new Linux virtual machine was created, and a Chinese garbled problem occurred with vim. The solution was as follows:
VI/etc/sysconfig/i18n
Change content
Lang = "zh_cn.gb18030"
Language = "zh_cn.gb18030: zh_cn.gb2312: zh_cn"
Supported = "zh_cn.gb18030: zh_cn: Zh: en_US.UTF-8: en_us: en"
Sysfont = "lat0-sun16"
In this way, the Chinese characters are displayed on the SSH terminal.
The main modification content is zh_cn.gb18030. Note that the content of the VI personality is under the root directory, and pay attention to permissions.
**************************
Every time Linux is installed, SSH connections are used. garbled characters are displayed in Chinese. 51testing Software Testing Network
Work und: edit/etc/sysconfig/i18n and change lang = "zh_CN.UTF-8" to Lang = "zh_cn.gb2312 ".
& M ^ % k7x6x7iq051testing software testing network K! W |, r8cv & r5n
Disconnect and reconnect.
****************************
Solution to Chinese garbled characters in Linux (12:55:45)
Copying files from windows to Linux is garbled. What should we do if we want to display Chinese Characters in Linux? First, let's test whether Chinese Characters in Linux can be properly displayed? A: Yes. The problem is obvious. The copied files in Windows cannot be displayed, indicating that the formats supported in Windows and Linux are different.
In Linux, UTF-8 is generally used, while in windows, gb2312 is used for file editing. Therefore, Chinese encoding is garbled. To correct this problem, it is actually very easy to convert the file into UTF-8 encoding format and then import it again.
Run the following command to convert the data:
Iconv-F gb2312-T UTF-8 test.txt> testutf8.tzt
(-F indicates the source code.-T indicates the conversion target, test.txtindicates the source file, and testutf8.txt generates the target encoding file)
Note: Use iconv-L to view the supported encoding formats. You can also add the encoding format:
The default value is utf8.
Command to manually change the configuration file:
Shell> VI/etc/sysconfig/i18n
Change lang = "zh_CN.UTF-8":
Lang = "zh_cn.gbk"
Save and close the configuration. Run the following command to make the configuration take effect:
Shell> source/etc/sysconfig/i18n
Display the terminal character encoding in simplified Chinese:
Shell> VI/etc/profile. d/Chinese. Sh
Add the following line: Export lc_all = zh_cn.gbk
Shell> source/etc/profile. d/Chinese. Sh
*******************************
Solve Java Chinese garbled characters in Linux

After JDK 15 ~ Create a fallback directory under/JRE/lib/fonts/and bake the font you want to use in Java to this directory.
The following method is passed in fc6. Assume that the user's JRE path is/usr/Java/jdk1.6.0 _ 03/JRE/
CD/usr/Java/jdk1.6.0 _ 03/JRE/lib/Fonts
Sudo mkdir fallback
Set c: \ windows \ fonts \ simsun. after the configuration of centos5.2 in the/usr/Java/jdk1.6.0 _ 03/JRE/lib/fonts/fallback folder is completed, the UTF-8 characters are displayed normally.
The connection between putty and SSH Secure Shell found garbled characters, mainly including executing Vim garbled characters and su command garbled characters.
Run the $ locale command to view the result, as shown below:
Lang = zh_CN.UTF-8
Language = zh_cn: ZH
Lc_ctype = "zh_CN.UTF-8"
Lc_numeric = "zh_CN.UTF-8"
Lc_time = "zh_CN.UTF-8"
Lc_collate = "zh_CN.UTF-8"
Lc_monetary = "zh_CN.UTF-8"
Lc_messages = "zh_CN.UTF-8"
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 =
Solution:
1. For putty0.6
A. Modify/ECT/sysconfig/i18n on centos:
Lang = "zh_CN.UTF-8"
B. In the Configuration window of putty, modify windows-> appearance-> font setting to the new, and enter 10.
Modify the receive data assumed to be in which character set of translation:
UTF-8. (Because there is no Chinese Character Set in the down list, gb2312 or cp936 ).
After the modification is completed, Putty will normally support Chinese display.
2. For the SSH Secure Shell version.
A. Change the font to, but it is garbled,
B. Modify/ECT/sysconfig/i18n of centos:
Lang = "zh_cn.gb18030"
Language = "zh_cn.gb18030: zh_cn.gb2312: zh_cn"
Supported = "zh_cn.gb18030: zh_cn: Zh: en_US.UTF-8: en_us: en"
Sysfont = "latarcyrheb-sun16"
--- The above content was found on the internet and written according to it.
The SSH Secure Shell connection is found to display Chinese characters normally.
Use $ locale to check whether the configuration above is changed to gb18030 encoding.
** However, Putty is used for connection, but it turns into garbled characters. I understand that putty still uses utf8 encoding,
When configuring SSH Secure Shell, centos is changed to gb18030 encoding, so garbled.
C. Go to the server, restart centos, and find that Chinese characters are displayed normally.
3. If you find that there is a problem with SSH Secure Shell or related problems, reconfigure putty,
For the configuration scheme, refer to the above configuration.
Conclusion:
Because the SSH Secure Shell window conforms to the window display, it is temporarily set to use the SSH Secure Shell client.
It is also bound with the FTP upload function, which is relatively convenient.
Change: consider setting up MySQL and other places to use UTF-8 encoding. All users still use the putty client, and the system encoding is changed to UTF-8.
######################################## ######################
Symptom: When connected using SSH software, the Chinese character is garbled: Modify the/etc/sysconfig/i18n file and change it to the following content: lang = "zh_cn.gb18030" Language = "zh_cn.gb18030: zh_cn.gb2312: zh_cn "supported =" zh_CN.UTF-8: zh_cn: Zh: en_US.UTF-8: en_us: en "sysfont =" latarcyrheb-sun16 "# source/etc/sysconfig/i18n restart the machine, the problem should be solved. Centos change lang = "zh_cn.gb18030" supported = "zh_cn.gb18030: zh_cn: Zh: en_US.UTF-8: en_us: en "sysfont =" lat0-sun16 "################################# #############################
Modify/etc/profile and add export lc_all = zh_cn # For Linux: zh_cn export lang = zh_cn # For Linux: zh_cn.

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.