Skip to content

Instantly share code, notes, and snippets.

@rogercampos
Created December 23, 2010 15:20
Show Gist options
  • Save rogercampos/753106 to your computer and use it in GitHub Desktop.
Save rogercampos/753106 to your computer and use it in GitHub Desktop.
Encode input files to ut8 from iso-8859-1
#!/usr/bin/env ruby
files = ARGV.select do |x|
`file -i #{x} | grep iso-8859-1` != ''
end
files.each do |file|
`iconv -f iso-8859-1 -t utf-8 #{file} > aux`
`mv aux #{file}`
puts "Converted #{file}"
end
puts "#{files.size} files converted to utf-8"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment