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-pagelink = templates.first
=> footerpage = @app.browser.click(link)
=> #WWW::Mechanize::Page......
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 }
=> “
<a\n"
href=“javascript:document.f3.SLID.value=‘F16’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>DIV\240id\240<a
href=“javascript:document.f3.SLID.value=‘F17’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>“footer”\n <a
href=“javascript:document.f3.SLID.value=‘F18’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>DIV\240id\240<a
href=“javascript:document.f3.SLID.value=‘F19’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>“footer-icons”\n <a
href=“javascript:document.f3.SLID.value=‘F20’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>IMG\240src\240<a
href=“javascript:document.f3.SLID.value=‘F21’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>”/lib/yhst-72759769340912/yahoo.gif"\n
<a
href=“javascript:document.f3.SLID.value=‘F22’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>IMG\240src\240<a
href=“javascript:document.f3.SLID.value=‘F23’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>"/lib/yhst-72759769340912/secure.gif"\n
<a
href=“javascript:document.f3.SLID.value=‘F24’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>DIV\240id\240<a
href=“javascript:document.f3.SLID.value=‘F25’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>“copyright”\n <a
href=“javascript:document.f3.SLID.value=‘F26’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>TEXT\240<a
href=“javascript:document.f3.SLID.value=‘F27’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>@copyright\n <a
href=“javascript:document.f3.SLID.value=‘F28’;%20document.f3.submit();”
title=“Select” onmouseover=“window.status=‘Select’;true;”
onmouseout=“window.status=’’;”>LINEBREAK\240\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 W.