多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > 綜合技術 > Linux使用技巧7--GBK轉成UTF-8

Linux使用技巧7--GBK轉成UTF-8

來源:程序員人生   發布時間:2015-05-15 07:49:13 閱讀次數:4135次

文件的內容編碼的轉換

Windows系統中編輯的Java源碼,在Linux下打開會出現中文亂碼的情況。緣由就是文件編碼格式的問題,Windows下通常是GBK而Linux下是UTF⑻。

在vim中用set fileencoding命令就能夠看出編碼格式,以下:

//linux下 fileencoding=utf-8 //windows下 fileencoding=latin1

最簡單的辦法就是在windows下將文件另存為utf8格式。那末在linux下我們可使用iconv工具將其轉換格式。

$ iconv --help Usage: iconv [OPTION...] [FILE...] Convert encoding of given files from one encoding to another. Input/Output format specification: -f, --from-code=NAME encoding of original text -t, --to-code=NAME encoding for output Information: -l, --list list all known coded character sets Output control: -c omit invalid characters from output -o, --output=FILE output file -s, --silent suppress warnings --verbose print progress information -?, --help Give this help list --usage Give a short usage message -V, --version Print program version
$ iconv -f GBK -t UTF-8 test.java -o test2.java

轉換終了,中文亂碼就不見了。

文件/文件夾名的轉換

這就要用到convmv工具了。

$ convmv Your Perl version has fleas #22111 #37757 #49830 convmv 1.15 - converts filenames from one encoding to another Copyright (C) 2003⑵011 Bjoern JACKE <bjoern@j3e.de> USAGE: convmv [options] FILE(S) -f enc encoding *from* which should be converted -t enc encoding *to* which should be converted -r recursively go through directories -i interactive mode (ask for each action) --nfc target files will be normalization form C for UTF-8 (Linux etc.) --nfd target files will be normalization form D for UTF-8 (OS X etc.) --qfrom be quiet about the "from" of a rename (if it screws up your terminal e.g.) --qto be quiet about the "to" of a rename (if it screws up your terminal e.g.) --exec c execute command instead of rename (use #1 and #2 and see man page) --list list all available encodings --lowmem keep memory footprint low (see man page) --nosmart ignore if files already seem to be UTF-8 and convert if posible --notest actually do rename the files --replace will replace files if they are equal --unescape convert%20ugly%20escape%20sequences --upper turn to upper case --lower turn to lower case --parsable write a parsable todo list (see man page) --help print this help

將tech目錄下的文件夾或文件遞歸轉換:

sudo convmv -f gbk -t utf-8 -r --notest tech/

另外需要注意,有時候在windows上用zip緊縮時也會帶來亂碼問題。

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: 美国毛片免费看 | 欧美一级毛片欧美大尺度一级毛片 | 羞羞网站在线播放 | 2020久久精品永久免费 | www爽| 国产精品日产三级在线观看 | 4日本私人vps生活大片 | 欧美人与黑人交 | 亚洲黄色影视 | 免费观看欧美一级高清 | 成人国产欧美精品一区二区 | 曰本人一级毛片免费完整视频 | 高级毛片 | 久久综合亚洲一区二区三区 | 最新精品亚洲成a人在线观看 | 欧美一区二区手机在线观看视频 | 免费麻豆国产一区二区三区四区 | 免费xxxxx大片在线观看影视 | 中文字幕动漫精品专区 | 久久精品免费i 国产 | 欧美性乱 | 国产福利影院 | 日本xxxx护士hd | 久久精品国产亚洲a不卡 | 国产午夜永久福利视频在线观看 | 春色精品视频在线播放 | 中文字幕国产视频 | 欧美激情免费a视频 | 亚洲精品久久久久中文 | 国产精品久久现线拍久青草 | 爱爱一级视频 | 欧美日韩国产最新一区二区 | 亚洲国产欧美久久香综合 | 欧美视频亚洲视频 | 欧美高清在线不卡免费观看 | 亚洲久久久久久久 | 免费在线观看亚洲 | 欧美日韩综合一区 | 国产精品亚洲欧美大片在线看 | 国内自拍偷拍 | 国产又黄又免费aaaa视频 |