linux修改文本编码格式 ascii 转 utf-8


ascii 转 utf-8 有 BOM

[root@applicationServer ~]# ll
total 8
-rw-------. 1 root root 1621 Sep 28 19:35 anaconda-ks.cfg
-rw-r--r--  1 root root    8 Jan  9 13:37 test.txt
[root@applicationServer ~]# cat test.txt
abcdefg
[root@applicationServer ~]# file test.txt
test.txt: ASCII text
[root@applicationServer ~]# echo -ne '\xEF\xBB\xBF' > out.txt
[root@applicationServer ~]# cat test.txt >> out.txt
[root@applicationServer ~]# ll
total 12
-rw-------. 1 root root 1621 Sep 28 19:35 anaconda-ks.cfg
-rw-r--r--  1 root root   11 Jan  9 13:40 out.txt
-rw-r--r--  1 root root    8 Jan  9 13:37 test.txt
[root@applicationServer ~]# file test.txt
test.txt: ASCII text
[root@applicationServer ~]# file out.txt
out.txt: UTF-8 Unicode (with BOM) text
[root@applicationServer ~]# cat out.txt
abcdefg
[root@applicationServer ~]#

文章作者: 鱍鱍
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 鱍鱍 !
  目录