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