BOM判定用rubyスクリプトを用意
参考: BOMチェック君 - 俺の基地
bomcheck.rb
dirs=["./trunk/unity/Assets/Source/**/*.cs","./trunk/unity/Assets/Editor/**/*.cs"]dirs.eachdo|dir|Dir.glob(dir).eachdo|f|nextunlessFile.file?(f)hoge=open(f)hoge.binmodebeginifhoge.read(3).unpack("h*")[0]!="febbfb"putsf.to_s#+ " is *NOT* BOM file"endrescueendendend
以下のとおり実行
$ for f in $(ruby bomcheck.rb); do vim -c "set fenc=utf-8 bomb" -c "x" $f; done