如何更改以及確認 file encoding - Linux

By Belly
at 2008-11-27T12:56
at 2008-11-27T12:56
Table of Contents
請問要如何更改及確認 file encoding?
====================
我是用 iconv 去改,寫成這樣的 shell sciript
把目前目錄底下的所有檔案改成 UTF-8
#!/bin/bash
for i in $(ls)
do
iconv -t UTF-8 $i > temp
mv temp $i
done
===================
但下 ls| xargs file 查看檔案屬性時
卻發現還是有很多 ASCII 編碼的
或是寫成 tex file, english text 之類的 看不出編碼:
abstractCH.tex: UTF-8 Unicode text
abstractEN.tex: ASCII English text
algorithmicx.sty: ASCII English text
algorithm.sty: ASCII English text
algpseudocode.sty: ASCII English text
application.tex: LaTeX document text
conclusion.tex: LaTeX document text
convert_to_utf.sh: Bourne-Again shell script text executable
defs.tex: ASCII text
errors.txt: ASCII text
introduction.tex: LaTeX document text
Makefile: ASCII make commands text
modeling.tex: LaTeX document text
ntu.sty: UTF-8 Unicode English text
ntuvars.tex: UTF-8 Unicode text
photoshoot.tex: LaTeX document text
related.tex: LaTeX document text
thesis.aux: LaTeX auxiliary file
thesis.bib: BibTeX text file
thesis.log: ASCII C++ program text
thesis.out: empty
thesis.pdf: empty
thesis.tex: LaTeX 2e document text
=================================
不知道是 iconv 的問題還是 file 的問題
除了 file,有沒別的方法可以確認編碼?
--
◎ Team Programming Dragon ◎
http://graphics.csie.ntu.edu.tw/~jonathan/tpd/
--
====================
我是用 iconv 去改,寫成這樣的 shell sciript
把目前目錄底下的所有檔案改成 UTF-8
#!/bin/bash
for i in $(ls)
do
iconv -t UTF-8 $i > temp
mv temp $i
done
===================
但下 ls| xargs file 查看檔案屬性時
卻發現還是有很多 ASCII 編碼的
或是寫成 tex file, english text 之類的 看不出編碼:
abstractCH.tex: UTF-8 Unicode text
abstractEN.tex: ASCII English text
algorithmicx.sty: ASCII English text
algorithm.sty: ASCII English text
algpseudocode.sty: ASCII English text
application.tex: LaTeX document text
conclusion.tex: LaTeX document text
convert_to_utf.sh: Bourne-Again shell script text executable
defs.tex: ASCII text
errors.txt: ASCII text
introduction.tex: LaTeX document text
Makefile: ASCII make commands text
modeling.tex: LaTeX document text
ntu.sty: UTF-8 Unicode English text
ntuvars.tex: UTF-8 Unicode text
photoshoot.tex: LaTeX document text
related.tex: LaTeX document text
thesis.aux: LaTeX auxiliary file
thesis.bib: BibTeX text file
thesis.log: ASCII C++ program text
thesis.out: empty
thesis.pdf: empty
thesis.tex: LaTeX 2e document text
=================================
不知道是 iconv 的問題還是 file 的問題
除了 file,有沒別的方法可以確認編碼?
--
◎ Team Programming Dragon ◎
http://graphics.csie.ntu.edu.tw/~jonathan/tpd/
--
Tags:
Linux
All Comments
Related Posts
Xubuntu安裝後.

By Edwina
at 2008-11-27T12:48
at 2008-11-27T12:48
Re: Linux套件及軟體安裝問與答

By Ula
at 2008-11-27T12:47
at 2008-11-27T12:47
Re: Linux套件及軟體安裝問與答

By Rae
at 2008-11-27T12:23
at 2008-11-27T12:23
Ubuntu 8.10:A user要新增資料在B user的資料夾

By Franklin
at 2008-11-27T11:20
at 2008-11-27T11:20
嘸蝦米終於正式的支援 Solaris 以及 gcin 和 s …

By Joseph
at 2008-11-27T08:15
at 2008-11-27T08:15