0

I have tried a ton of stuff for instance:

Mechanize on Ruby 1.9.3 encoding issue and How do I convert from a Mechanize::File object to a Mechanize::Page object?

But the error I keep getting is

.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/util.rb:59:in `encode': code converter not found (UTF-8 to UTF8) (Encoding::ConverterNotFoundError)
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/util.rb:59:in `encode_to'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/util.rb:45:in `from_native_charset'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:187:in `from_native_charset'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:181:in `block in proc_query'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:180:in `map'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:180:in `proc_query'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:206:in `block in build_query'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:198:in `each'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:198:in `build_query'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:249:in `request_data'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize.rb:618:in `post_form'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize.rb:520:in `submit'
    from /home/dhahn/.rvm/gems/ruby-1.9.3-p194/gems/mechanize-2.0.1/lib/mechanize/form.rb:167:in `submit'
    from /home/dhahn/user-management/test_script/EWI.rb:73:in `add_ext'
    from testewi.rb:15:in `<main>'

I have a class that uses mechanize and it works with ruby 1.8.7, but I need it to work with 1.9.3 because the rest of the rails app is in 1.9.3. Sorry I'm kind of clutter brained right now so if I need to include something else please let me know. This is also my first question on here.

Community
  • 1
  • 1
David Hahn
  • 740
  • 9
  • 26

1 Answers1

1

The page you're visiting may have incorrectly described its encoding.

I think the fix is change it yourself, by doing something like

page.encoding = "utf-8"
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338