Skip to content

Instantly share code, notes, and snippets.

@ryangraham
Created March 22, 2012 02:39
Show Gist options
  • Save ryangraham/2155274 to your computer and use it in GitHub Desktop.
Save ryangraham/2155274 to your computer and use it in GitHub Desktop.
prepend utf8 byte order mark (bom) and then rewrite file line by line
module UnfuckUnicode
def byteordermarkify(old,new)
File.open(new, 'w') do |out|
out << "\xEF\xBB\xBF"
File.foreach(old) do |line|
out << line
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment