From: Jeremy Woertink Date: 2009-11-18T08:30:10+09:00 Subject: Nokogiri help I keep getting this error "encoding error : output conversion failed due to conv error, bytes 0xA0 0x69 0x64 0xC2 I/O error : encoder error" whenever I try to append my html string to Nokogiri::HTML. When I write that doc to a file, some of the spaces, or possibly letters are weird looking characters. Here is my (partial) output in irb: ... >> templates = templates_page.search('/html/body/table[3]/tr[2]/td[2]//a') => footerhas-sub-sectionsheaderhomeitem-pagejustpro-888-519-5878left-navsearchsection-page >> link = templates.first => footer >> page = @app.browser.click(link) => # >> template_body = page.search('/html//body/form//pre') =>
DIV?id?"footer"
    DIV?id?"footer-icons"
      IMG?src?"/lib/yhst-72759769340912/yahoo.gif"
      IMG?src?"/lib/yhst-72759769340912/secure.gif"
    DIV?id?"copyright"
      TEXT?@copyright
      LINEBREAK?
  
>> t = template_body.to_html.gsub(/[;|\s][a-zA-Z-]+[&|\s]/m) { |match| ?> if match != " return " >> val = %{|#{match.scan(/[a-zA-Z-]+/).first}} >> match.gsub(/[a-zA-Z-]+/, val) >> end >> } => "
DIV\240id\240\"footer\"\n  DIV\240id\240\"footer-icons\"\n    IMG\240src\240\"/lib/yhst-72759769340912/yahoo.gif\"\n
IMG\240src\240\"/lib/yhst-72759769340912/secure.gif\"\n
DIV\240id\240\"copyright\"\n    TEXT\240@copyright\n    LINEBREAK\240\n
\n" >> doc = Nokogiri::HTML(<<-eohtml) #{t} eohtml encoding error : output conversion failed due to conv error, bytes 0xA0 0x69 0x64 0xC2 I/O error : encoder error => Is there something I should do different? Thanks, ~Jeremy Woertink -- Posted via http://www.ruby-forum.com/.