Robert Poor
2012-Jan-27 20:41 UTC
[Mechanize-users] dealing with Encoding::UndefinedConversionError: "\xA2" from ASCII-8BIT to UTF-8
I''m 99% certain that this is what''s being discussed in
https://github.com/tenderlove/mechanize/issues/168
But I''m not sure what the remedy is. My production app is running on
Heroku, so I need a fix that I can push there. Can someone post
instructions that this neophyte can follow? (I gather I''m supposed to
fork
and add the current master version from github to my config, but I need
simple little steps for muddy little feet.) Thanks...
I''m running Rails 3.2, Mechanize 2.1. Mechanize is failing with
Encoding::UndefinedConversionError: "\xA2" from ASCII-8BIT to
UTF-8
with this (partial) stack trace:
from
/app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:807:in
`block in response_read''
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:387:in `call_block''
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:378:in `<<''
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:88:in `read''
from /usr/local/lib/ruby/1.9.1/net/http.rb:2445:in `read_chunked''
from /usr/local/lib/ruby/1.9.1/net/http.rb:2419:in `read_body_0''
from /usr/local/lib/ruby/1.9.1/net/http.rb:2379:in `read_body''
from
/app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:795:in
`response_read''
from
/app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:267:in
`block in fetch''
from /usr/local/lib/ruby/1.9.1/net/http.rb:1194:in `block in
transport_request''
from /usr/local/lib/ruby/1.9.1/net/http.rb:2342:in `reading_body''
from /usr/local/lib/ruby/1.9.1/net/http.rb:1193:in `transport_request''
from /usr/local/lib/ruby/1.9.1/net/http.rb:1177:in `request''
from
/app/vendor/bundle/ruby/1.9.1/gems/net-http-persistent-2.3.3/lib/net/http/persistent.rb:621:in
`request''
from
/app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize/http/agent.rb:264:in
`fetch''
from
/app/vendor/bundle/ruby/1.9.1/gems/mechanize-2.1/lib/mechanize.rb:319:in
`get''
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/mechanize-users/attachments/20120127/76b5ea73/attachment.html>
Robert Poor
2012-Jan-27 21:52 UTC
[Mechanize-users] dealing with Encoding::UndefinedConversionError: "\xA2" from ASCII-8BIT to UTF-8
Okay, solved it myself (and feeling ever so slightly chuffed about it
all!). I noticed that one of the comments in
https://github.com/tenderlove/mechanize/issues/168
from @zzak said:
"Using master fixed this for me too, I just
forked<https://github.com/zzak/mechanize> and
added a gemspec using
hoe-gemspec<https://github.com/flavorjones/hoe-gemspec> so
that I could use it with bundler in my project."
So I changed the line in my Gemspec from:
# gem ''mechanize''
to
gem ''mechanize'', :git =>
''git://github.com/zzak/mechanize.git''
... and it fixed the problem. Thank you, Mr. Scott!! (Now I have to track
down the ''undefined methods `flush` for nil:NilClass problems, but I
see
that''s already reported as well!)
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/mechanize-users/attachments/20120127/b4856f45/attachment.html>
Eric Hodel
2012-Jan-27 21:53 UTC
[Mechanize-users] dealing with Encoding::UndefinedConversionError: "\xA2" from ASCII-8BIT to UTF-8
On Jan 27, 2012, at 12:41 PM, Robert Poor wrote:> I''m 99% certain that this is what''s being discussed in > > https://github.com/tenderlove/mechanize/issues/168 > > But I''m not sure what the remedy is. My production app is running on Heroku, so I need a fix that I can push there. Can someone post instructions that this neophyte can follow? (I gather I''m supposed to fork and add the current master version from github to my config, but I need simple little steps for muddy little feet.)There''s several forks of mechanize that have the fix, you can use one of them or downgrade to a previous version of mechanize.> Thanks... > > I''m running Rails 3.2, Mechanize 2.1. Mechanize is failing with > > Encoding::UndefinedConversionError: "\xA2" from ASCII-8BIT to UTF-8I should have a release out be the end of next week that fixes this bug.
Seemingly Similar Threads
- Load Error Using Mechanize Gem
- Encoding::UndefinedConversionError on a simple file upload (rvm, MRI-1.9.2-p0, rails 3.0.1, apache+passenger)
- [Win7 x64] Encoding::UndefinedConversionError after installing when using gem and rails
- NoMethodError: undefined method `force_encoding' for "Conten
- LIbrary to maintain manage browser sessions from command line