I found some solutions using post_connect_hook and pre_connect_hook, but it seems like they don’t work. I’m using the latest Mechanize version (2.1). There are no [:response] fields in the new version, and I don’t know where to get them in the new version.
- https://gist.github.com/search?q=pre_connect_hooks
- https://gist.github.com/search?q=post_connect_hooks
Is it possible to make Mechanize return a UTF8 encoded version, instead of having to convert it manually using iconv?
Since Mechanize 2.0, arguments of
pre_connect_hooks()andpost_connect_hooks()were changed.See the Mechanize documentation:
Now you can’t change the internal response-body value because an argument is not array. So, the next best way is to replace an internal parser with your own: