Skip to content

Instantly share code, notes, and snippets.

@firebelly
Created December 19, 2011 17:38
Show Gist options
  • Save firebelly/1498104 to your computer and use it in GitHub Desktop.
Save firebelly/1498104 to your computer and use it in GitHub Desktop.
simple non-ascii stripping script
# courtesy http://stackoverflow.com/questions/1268289/how-to-get-rid-of-non-ascii-characters-in-ruby
class String
def remove_non_ascii
require 'iconv'
Iconv.conv('ASCII//IGNORE', 'UTF8', self)
end
end
Wiki.all.each { |w|
w.content = w.content.remove_non_ascii
w.abstract = w.abstract.remove_non_ascii
w.save
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment