Terminal garbled under Linux operating system

  

When using linux's terminal tool SecureCRT, every time you submit SVN to input Chinese logs, you can't lose Chinese.

svn ci -m "" There is no way to enter Chinese between the two quotes.

Later, I asked other students to find a solution.

To ensure that SecureCRT is in UTF8 format, set: option-session option-terminal-appearance character encoding, select utf- 8

First, create a file under /home/yourname. Vimrc, then write the following code in this file

1 set fencs=utf-8, ucs-bom, shift-jis, gb18030, gbk, gb2312, cp936

2 set termencoding=utf -8

3 set encoding=utf-8

4 set fileencodings=ucs-bom,utf-8,cp936

5 set fileencoding=utf-8

6 set nohls

7 set nu

8 filetype on

9 syntax on

10 set tabstop=4

11 set shiftwidth=4

12 set autoindent

13 set smartindent

14 set showmatch

15 set ruler

16

The general meaning of the code is that the terminal supports UTF8, which means it can support Chinese.

Then execute the following command on the command line

[yourname@root]$ export LANG=zh_CN.UTF-8

Try again

[yourname @root]$ svn ci -m "Submit Chinese Tips"

If you want the SSH client to start, execute export LANG=zh_CN.UTF-8 and look for it in /home/yourname. Bash_profile file, then modified with vim

14:14 [[email protected]]$ vim .bash_profile

1 # .bash_profile

2

3 # Get the aliases and functions

4 if [ -f ~/.bashrc ]; then

5 . ~/.bashrc

6 fi

7

8 # User specific environment and startup programs

9

10 PATH=$PATH:$HOME/bin

11< Br>

12 export PATH

13 unset USERNAME

14 export LANG=zh_CN.UTF-8

After saving, restart the SSH client so that each Export LANG=zh_CN.UTF-8 is automatically executed when the client is started.

You're done.

Using the export command to set environment variables in Linux

Copy an online article

export LANG=zh_CN.UTF-8

export LANG= en_US

=================================================== =========================================================== ==

================================================== =========================================================== ===

Programmers who are new to Linux often get garbled greetings. It can be said that "the beginning of chaos and abandon". Because of garbled, and eventually gave up Linux is not a minority. Ok, let's get down to business, let's see how the various garbles are formed.

Chinese characters garbled

This situation is generally installed with the Chinese console, but not enabled by the Chinese application. Just start the appropriate software, such as zhcon. Or the corresponding software is enabled, but the character set is wrong, you need to set the corresponding character set, such as export LANG=zh_CN.UTF-8

ORACLE installation interface garbled

Although ORACLE supports multiple languages, will According to the environment variable, the character set is automatically selected, but the Chinese installation seems to have problems, but the version after 10.2 does not seem to have this problem. You can run the command export LANG=en_US to set the English character set environment.

English characters Garbled code

Generally, the character garbled appears in the cat binary file. Because there are many control codes in the binary file, the terminal interface will be garbled. The usual solution is to use the reset terminal reset command to solve the problem [nextpage]

Other pseudo-terminal garbled

Sometimes when you enter the remote LINUX server through SSH, cat a core file, and the reset command can not be successful, what should I do? Very simple, look at the following test, first cat a python compiled file

oracle@linux-suse:~> cat fibo.pyc

m?

{?鲱c@sd

Zd

ZdS(cCs:d\\}}x' jo G }}qWdS(Nii(ii(tatbtn(RRR((tfibo.pytfibs

cCsIg}d\\}}x0 jo" i }}qW S(Nii(ii(tresultRRRtappend(RRRR((Rtfib2 s

N(RR(RR(Rt?s oracle@linux-suse:~> ; VT102VT102

\\-bash: VT102VT102: command not found

oracle@linux-suse:~>

See garbled on the SSH terminal, prompt It is messy, you can use the following command to restore

oracle@linux-suse:~> tput sgr0

The garbled problem is caused by SSH, because in other terminals, cat Using a file, there will be no garbled, so the reason for the garbled test

oracle@linux-suse:~> ^N

Just use ctrl+v, ctrl+n The screen is garbled, of course, try again after recovery

oracle@linux-suse:~> echo -e '\\xe'

The screen is garbled again, well, then restore

oracle@linux-suse:~> echo -e '\\xf'

The above is a blind call, because The screen sees garbled characters. The final problem is caused by the hexadecimal character E. The solution is also very simple. The hexadecimal character F can be

Copyright © Windows knowledge All Rights Reserved