skip to content

Mechanize force encoding error

Let's fix this very annoying problem with mechanize

Ruby’s mechanize gem is very useful, specially when combined with Nokogiri. But if you find an encoding error like:

/var/lib/gems/1.8/gems/mechanize-0.9.3/lib/www/mechanize/page.rb:37:in `initialize': undefined method `force_encoding' for <String:0xb7410070> (NoMethodError)

Then you will need to apply this patch ;)

http://github.com/eric/mechanize/commit/7fd877c60cbb3855652c390c980df1dedfaed820