How to solve the problem of Linux client garbled

Source: Internet
Author: User
Tags echo command i18n

recently use Xshell Landing English version of Redhat, because some files are Chinese code, in the Xshell display garbled. Toss for a long time finally found a solution to the method, hope can be useful to everyone. Other languages garbled words, the solution is similar to this!

First check if the system's language settings are in Chinese. Enter the command under Terminal:

# echo $LANG

If not, you need to modify the environment variables. There are several ways to modify an environment variable, and a simple summary of three more commonly used:

1>

   is only modified for the current terminal and has no effect on other users

Enter at the command line:

# export Lang=en_us.utf-8

This modification is only valid for the current terminal. Ends when the terminal exits. If you want to see the languages and character sets supported by the system, you can modify the bash profile for the current user with the command

# locale-a

2>    for the current user. When a user logs on to the export into the lang variable

first into the current user's home directory, such as the root user's home directory is/root/, the other user's home directory is generally/home/username/

# ls-a

to see the. bash_profile this hidden file, enter the command under Terminal:

# echo "Export Lang=en_us.utf-8" >>. Bash_profile

What does this command do? The output redirection of the echo command is output to the end of the. Bash_profile

3>    Modify for all users

Edit/etc/sysconfig/ i18n This file, i18n is the abbreviation for internationalization, which indicates that there are 18 letters between I and N, meaning the internationalization of the software. I18N supports multiple languages, but the same time can only be in English and a selected language, such as English + Chinese, English + Japanese and so on. The

modifies the value of the lang variable to

above only modifying the system's character encoding. But even if the code is correct, it can be garbled under Xshell. Because the Xshell also has a coded setting. There is a encoding button on the Xshell toolbar, click this button to select the encoding. If it is garbled in Japanese, you can generally choose three kinds of Unicode (UTF-8), Japanese (EUC), Japanese (SHIFT-JIS), which is the correct display is not garbled with the file to display the encoding used.

Of course, the second and third way to restart the shell, except for the first way you can get the settings to take effect immediately.

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.