Skip to content

Instantly share code, notes, and snippets.

@resolve
Created October 1, 2009 04:13
Show Gist options
  • Save resolve/198725 to your computer and use it in GitHub Desktop.
Save resolve/198725 to your computer and use it in GitHub Desktop.
def convert_encoding(result)
["’", "’"].each do |quote|
result.gsub!(quote, "'")
end
["—", "―"].each do |mdash|
result.gsub!(mdash, "—")
end
result.gsub!("…", "…")
result.gsub!("â„¢", "™")
["“", "“"].each do |doublequote|
result.gsub!(doublequote, "\"")
end
result
end
PagePart.all.each do |pp|
pp.update_attribute(:body, convert_encoding(pp.body))
end
NewsItem.all.each do |ni|
ni.update_attribute(:body, convert_encoding(ni.body))
ni.update_attribute(:blurb, convert_encoding(ni.blurb))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment