Skip to content

Instantly share code, notes, and snippets.

@maiha
Created April 19, 2009 09:54
Show Gist options
  • Select an option

  • Save maiha/97996 to your computer and use it in GitHub Desktop.

Select an option

Save maiha/97996 to your computer and use it in GitHub Desktop.
namespace "binary" do
desc "detect unknown binary chars from source codes"
task "check" do
c2a0 = /\xc2\xa0/no
files = Dir.glob("{app,config,lib}/**/*.{rb,html,erb.haml}")
files.each do |file|
buf = File.read(file){}
if c2a0 === buf
puts "[C2A0] detected in [%s]" % file
File.readlines(file).each_with_index do |line, i|
puts " %4d: %s" % [i+1, line] if c2a0 === line
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment