超碰中文网,91久久精品日日躁夜夜躁欧美,一区二区三区精品道,一区二区国产在线观看,亚洲精品中文字幕乱码一区二区,天天看片高清影视在线观看,久久99精品久久久久蜜桃,久久成人影视

VPS參考測(cè)評(píng)推薦
專注分享VPS主機(jī)優(yōu)惠信息
衡天云優(yōu)惠活動(dòng)
熱網(wǎng)互聯(lián)2026年促銷活動(dòng)
hostkvm優(yōu)惠促銷活動(dòng)
zji優(yōu)惠促銷活動(dòng)
QQGNET優(yōu)惠促銷活動(dòng)
QQGNET優(yōu)惠促銷活動(dòng)

linux中字符亂碼應(yīng)該如何解決?

主機(jī)參考:VPS測(cè)評(píng)參考推薦/專注分享VPS服務(wù)器優(yōu)惠信息!若您是商家可以在本站進(jìn)行投稿,查看詳情!此外我們還提供軟文收錄、PayPal代付、廣告贊助等服務(wù),查看詳情!
我們發(fā)布的部分優(yōu)惠活動(dòng)文章可能存在時(shí)效性,購(gòu)買時(shí)建議在本站搜索商家名稱可查看相關(guān)文章充分了解該商家!若非中文頁(yè)面可使用Edge瀏覽器同步翻譯!PayPal代付/收錄合作

linux中字符亂碼應(yīng)該如何解決?很多人都不太了解,今天小編為了讓大家更加了解linux中字符亂碼的解決方案,所以給大家總結(jié)了以下內(nèi)容,一起往下看吧。

How to solve the character disorder in Linux? Many people don't know much about it. Today, in order to let you know more about the solution of character scrambling in Linux, Xiaobian summarized the following content for you, let's look down together.

遠(yuǎn)程登錄linux服務(wù)器用vim在終端下編輯查看文件經(jīng)常會(huì)遇見各種中文亂碼問題。

Remote login Linux server using VIM to edit and view files under the terminal will often encounter a variety of Chinese code problems.

做如下設(shè)置可基本解決vim中文亂碼問題

The following settings can basically solve the problem of vim Chinese scrambling

首先查看系統(tǒng)對(duì)中文的支持

First check the system's support for Chinese

locale -a | grep zh_CN

locale -a | grep zh_CN

輸出樣例如下

An exle of the output is as follows

zh_CN.gbk

Zh_CN.gbk

zh_CN.utf8

Zh_CN.utf8

vim 只能正確識(shí)別列表中的中文編碼文件,如需識(shí)別其他編碼類型的中文文件,則需要做系統(tǒng)升級(jí)

VIM can only correctly identify the Chinese code files in the list. If it needs to identify other types of Chinese code files, it needs to upgrade the system

vi ~/.bash_profile

vi ~/.bash_profile

文件末尾添加

Add at end of file

export LANG="zh_CN.UTF-8"

export LANG="zh_CN.UTF-8"

export LC_ALL="zh_CN.UTF-8"

export LC_ALL="zh_CN.UTF-8"

vim與編碼相關(guān)的參數(shù):

VIM coding related parameters:

1、eencoding,用于配置打開文件和保存文件的編碼,但只能有一個(gè)值,只適合少數(shù)文件都是同種編碼的環(huán)境,所以一般不使用

1. Eencoding is used to configure the encoding for opening and saving files, but it can only have one value. It is only suitable for a few files in the same encoding environment, so it is generally not used

2、fileencodings, 從名字上看就知道是fileencoding的增強(qiáng)版,可以配置多種不同的編碼,常見的配置為,配置好之后,列表中的文本編碼只要合法,都能被vim正確 的讀取,建議配置:set fileencodings=utf-bom,utf-8,gbk,gb2312,gb18030,cp936,latin1

2. Fileencodings, as you can see from the name, is an enhanced version of fileencodings, which can be configured with many different codes. The common configuration is that after configuration, the text codes in the list can be read correctly by VIM as long as they are legal. It is recommended to configure: set fileencodings = UTF BOM, UTF-8, GBK, GB2312, GB18030, cp936, Latin1

3、encoding,vim內(nèi)部編碼,vim讀取文件之后,但并不以讀取文件的編碼來(lái)處理,而是會(huì)轉(zhuǎn)換成內(nèi)部編碼的格式,這個(gè)編碼一般與操作系統(tǒng)相關(guān),linux下utf-8居多,中文windows下則是gdk,建議配置:set encoding=utf-8

3. Encoding, VIM internal encoding. After VIM reads the file, it is not processed by the encoding of the read file, but will be converted to the format of internal encoding. This encoding is generally related to the operating system. UTF-8 is the majority in Linux, GDk in Chinese windows. It is recommended to configure: Set encoding = UTF-8

4、termencoding,vim輸出的編碼,輸出指輸出到操作系統(tǒng)或命令終端等,默認(rèn)與操作系統(tǒng)的語(yǔ)言編碼一致,如果使用linux命令終端,建議終端和linux系統(tǒng)配置相同的編碼,然后配置相同的termencoding,否則顧全了vim就顧不上shell,不過如果shell不存在中文名文件,則配置終端和 termencoding一致即可,對(duì)于windows,能自動(dòng)的識(shí)別gbk和utf-8,不用特殊配置,建議配置:set termencoding=utf-8

4. Termencoding, the encoding of vim output, output refers to output to the operating system or command terminal, which is the same as the language encoding of the operating system by default. If Linux command terminal is used, it is recommended that the terminal and Linux system configure the same encoding, and then configure the same termencoding, otherwise VIM will ignore the shell, but if there is no Chinese name file in the shell, the configuration is final For windows, it can automatically identify GBK and UTF-8 without special configuration. The recommended configuration is set termencoding = UTF-8

5、fileformats,用于區(qū)分操作系統(tǒng),主要是回車rn的區(qū)別,建議配置:set fileformats=unix,dos

5. Fileformats, used to distinguish operating systems, mainly the difference of carriage return. It is recommended to configure: set fileformats = UNIX, DOS

常見的亂碼有以下幾種情形:

There are several common cases of garbled Code:

(1)將windows環(huán)境下的文件rz到linux下時(shí)文件出現(xiàn)亂碼

(1) When RZ file under Windows environment is transferred to Linux, the file appears garbled

解決方案:

Solution:

1、在rz之前使用notepad++將文件格式轉(zhuǎn)化為UTF-8無(wú)BOM格式或者ANSI編碼格式;

1. Before RZ, use Notepad + + to convert the file format to UTF-8 format without BOM or ANSI encoding format;

2、set encoding=utf-8;

2、set encoding=utf-8;

(2)secureCRT或者xterm2編輯環(huán)境中出現(xiàn)亂碼,只需在會(huì)話選項(xiàng)中調(diào)節(jié)字符編碼為GB2312或者UTF-8

(2) in the secureCRT or xterm2 editing environment, the encoding is only GB2312 or UTF-8 in the session options.

(3)當(dāng)對(duì)日志文件進(jìn)行vim編輯時(shí)出現(xiàn)亂碼,大多數(shù)情況下是因?yàn)?a target="_blank" href="http://www.k2270.com/tag/16425/" title="【查看含有[日志]標(biāo)簽的文章】" target="_blank">日志文件的格式為GB2312。

(3) When the log file is VIM edited, there is garbled code, mostly because the format of the log file is GB2312.

解決方案:1.set encoding=GB2312;2如果方案1不起作用的話,調(diào)整secureCRT或者xterm2的編輯環(huán)境為GB2312

Solution: 1. Set encoding = GB2312; 2 if scheme 1 does not work, adjust the editing environment of SecureCRT or xterm2 to GB2312

(4)wget下載文件名亂碼

(4) WGet download file name garbled

解決方案:一般情況下加上–restrict-file-names=nocontrol,例如wget --restrict-file-names=nocontrol -m www.xxx.com/

Solution: in general, add - restrict file names = nocontrol, such as WGet -- restrict file names = nocontrol - M www.xxx.com/

(5)cat文件正常,vim文件不正常

(5) Cat file is normal, VIM file is abnormal

解決方案:直接寫入/etc/vim/vimrc ?,最后一行加上

Solution: write directly to / etc / VIM / vimrc, and add the last line

set fileencodings=gb2312,utf-8

set fileencodings=gb2312,utf-8

set fileencoding=gb2312

set fileencoding=gb2312

set termencoding=utf-8

set termencoding=utf-8

關(guān)于linux中字符亂碼應(yīng)該如何解決就分享到這里了,當(dāng)然并不止以上和大家分析的辦法,不過小編可以保證其準(zhǔn)確性是絕對(duì)沒問題的。希望以上內(nèi)容可以對(duì)大家有一定的參考價(jià)值,可以學(xué)以致用。如果喜歡本篇文章,不妨把它分享出去讓更多的人看到。

How to solve the character disorder in Linux will be shared here. Of course, it's not only the above analysis method, but also the small code can ensure its accuracy is absolutely no problem. Hope that the above content can have a certain reference value for you, can learn to apply. If you like this article, you can share it for more people to see.

--------------------------------------------------------------
主機(jī)參考,收集國(guó)內(nèi)外VPS,VPS測(cè)評(píng),主機(jī)測(cè)評(píng),云服務(wù)器,虛擬主機(jī),獨(dú)立服務(wù)器,國(guó)內(nèi)外服務(wù)器,高性價(jià)比建站主機(jī)相關(guān)優(yōu)惠信息@www.k2270.com
詳細(xì)介紹和測(cè)評(píng)國(guó)外VPS主機(jī),云服務(wù)器,國(guó)外服務(wù)器,國(guó)外主機(jī)的相關(guān)優(yōu)惠信息,商家背景,網(wǎng)絡(luò)帶寬等等,也是目前國(guó)內(nèi)最好的主機(jī)云服務(wù)器VPS參考測(cè)評(píng)資訊優(yōu)惠信息分享平臺(tái)

這幾篇文章你可能也喜歡:

本文由主機(jī)參考刊發(fā),轉(zhuǎn)載請(qǐng)注明:linux中字符亂碼應(yīng)該如何解決? http://www.k2270.com/14183.html

【騰訊云】領(lǐng)8888元采購(gòu)禮包,搶爆款云服務(wù)器 每月 9元起,個(gè)人開發(fā)者加享折上折!
打賞
轉(zhuǎn)載請(qǐng)注明原文鏈接:主機(jī)參考 » linux中字符亂碼應(yīng)該如何解決?
主機(jī)參考僅做資料收集,不對(duì)商家任何信息及交易做信用擔(dān)保,購(gòu)買前請(qǐng)注意風(fēng)險(xiǎn),有交易糾紛請(qǐng)自行解決!請(qǐng)查閱:特別聲明

相關(guān)推薦

評(píng)論 搶沙發(fā)

評(píng)論前必須登錄!