Skip to content

Instantly share code, notes, and snippets.

@jeregrine
Created October 18, 2012 15:55
Show Gist options
  • Save jeregrine/3912739 to your computer and use it in GitHub Desktop.
Save jeregrine/3912739 to your computer and use it in GitHub Desktop.
Encoding::UndefinedConversionError - "\xC2" from ASCII-8BIT to UTF-8 Fix
lines = IO.readlines("app/views/terms.haml").map do |line|
line.encode('ASCII-8BIT', :invalid => :replace, :undef => :replace)
end
File.open("app/views/terms2.haml", "w") do |file|
file.puts(lines)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment