Skip to content

Instantly share code, notes, and snippets.

@wnoguchi
Forked from yasuyk/utf8-mac_2_utf-8.rb
Created October 13, 2013 23:13
Show Gist options
  • Save wnoguchi/6968431 to your computer and use it in GitHub Desktop.
Save wnoguchi/6968431 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# http://sssslide.com/speakerdeck.com/a_matsuda/rails3-recipe-book-gaiden#114
ARGV.each do |file|
File.open(file,'r+:UTF8-MAC') do |f|
str = f.read
f.rewind
f.truncate(0)
f.set_encoding('UTF-8')
f.write(str)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment