Linux Open Chinese garbled, set fileencoding for Latin1__linux

Source: Internet
Author: User

Turn 1. Http://blog.sina.com.cn/s/blog_40e1ba640102wm26.html

2.http://www.cnblogs.com/joeyupdo/archive/2013/03/03/2941737.html
The following is an introduction to copy Link 2
(1) Encoding:vim internal use of the character encoding method, including Vim buffer (buffers), menu text, message text and so on. The user's manual suggests changing its value only in. VIMRC, and in fact it seems only meaningful to change its value in. vimrc.

(2) The character encoding of the file currently edited in Fileencoding:vim, Vim saves the file as this character encoding (whether or not the new file is the case), the Internet is introduced, But I did it in. VIMRC defined as Utf-8 seems to have no effect, only when the vim file open the manual settings will be effective, do not know why.

(3) When Fileencodings:vim starts, it detects the character encoding of the file that will be opened, and sets the fileencoding to the final detected character encoding, according to the character encoding it lists. So it's best to put the Unicode encoding at the top of this list, and put the Latin coding latin1 on the last side.

(4) The character encoding of the terminal (or Windows Console window) that the Termencoding:vim is working on. This option is not valid for the gVim of our commonly used GUI schemas under Windows, and for Vim in console mode is the code page for the Windows console, and usually we don't need to change it.

The system locale is Utf-8 (many Linux system default locale form), the edited document is GB2312 or GBK form (Windows Notepad
Default save form, most editors also default to this form, so most common, terminal type Utf-8 (that is, the assumption that the client is a putty class of Unicode software)
Then vim opened the document, Encoding=utf-8 (locale decision), FILEENCODING=LATIN1 (automatic coding mechanism is not allowed to cause), termencoding= null (the default without conversion term encoding), display files for garbled.
Solution 1: First of all to fix the fileencoding as cp936 or EUC-CN (the two, just different), note that the modified method is not: set
fileencoding=cp936, this just saves the file as cp936, and the correct way is to reload the file as cp936 encoding: Edit
++enc=cp936, can be abbreviated as: E ++enc=cp936.

But doing so, the file is closed and then reopened and reset again. Garbled in the final analysis of the reason is that vim can not recognize the file encoding, resulting in the normal decoding (do not know is not called decoding, I understand). So, I set the fileencodings in. VIMRC, which tells Vim to try in so many ways when decoding the file Utf-8, set fileencoding=utf-8 set Fileencodings=ucs-bom, Utf-8,cp936,latin1. It's turned on normally.

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.