Created
January 21, 2012 20:13
-
-
Save dmitry/1653836 to your computer and use it in GitHub Desktop.
Auto-convert all mechanize pages to UTF-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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