Skip to content

Instantly share code, notes, and snippets.

@CvX
Created May 20, 2014 10:48
Show Gist options
  • Save CvX/1052a8dc7c9c6a83c5dc to your computer and use it in GitHub Desktop.
Save CvX/1052a8dc7c9c6a83c5dc to your computer and use it in GitHub Desktop.
Fin offending utf chars
Dir.glob(File.join('**', '*.coffee')).each do |path|
File.open(path, 'r+') do |file|
string = file.read
string.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
file.rewind
file.write(string)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment