Skip to content

Instantly share code, notes, and snippets.

@dmitry
Created January 21, 2012 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry/1653836 to your computer and use it in GitHub Desktop.
Save dmitry/1653836 to your computer and use it in GitHub Desktop.
Auto-convert all mechanize pages to UTF-8
class Mechanize
alias_method :original_get, :get
def get *args
doc = original_get *args
encoding = doc.encodings.last
doc.content.encode!('UTF-8', encoding)
doc
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment