public
Created

Auto-convert all mechanize pages to UTF-8

  • Download Gist
mechanize_auto_utf8.rb
Ruby
1 2 3 4 5 6 7 8 9
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.