1、如何查看一个文件使用哪种字符集:

vim filename

:set encoding

结果:fileencoding=utf-8 

2、字符集转换:

for filename in `ls -1 *.*`
do
        cd  路径
        iconv -f UTF-8 -t GB18030 ${filename} > ${filename}.tmp
        mv  ${filename}.tmp  ${filename}
done

主要代码:

iconv -f UTF-8 -t GB18030