title: How to set the mechanize page encoding?
body: <p>I'm trying to get a page with an ISO-8859-1 encoding clicking on a link, so the code is similar to this:</p>
  
  <pre><code>page_result = page.link_with( :text =&gt; 'link_text' ).click
  </code></pre>
  
  <p>So far I get the result with a wrong encoding, so I see characters like:</p>
  
  <pre><code>'T�tulo:' instead of 'Título:'
  </code></pre>
  
  <p>I've tried several approaches, including:</p>
  
  <ul>
  <li><p>Stating the encoding in the first request using the agent like:</p>
  
  <pre><code>@page_search = @agent.get(
    :url =&gt; 'http://www.server.com',
    :headers =&gt; { 'Accept-Charset' =&gt; 'ISO-8859-1' } )
  </code></pre></li>
  <li><p>Stating the encoding for the page itself</p>
  
  <pre><code>  page_result.encoding = 'ISO-8859-1'
  </code></pre></li>
  </ul>
  
  <p>But I must be doing something wrong: a simple puts always show the wrong characters. </p>
  
  <p>Do you know how to state the encoding?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Added: Executable example:</p>
  
  <pre><code>require 'rubygems'
  require 'mechanize'
  
  WWW::Mechanize::Util::CODE_DIC[:SJIS] = "ISO-8859-1"
  
  @agent = WWW::Mechanize.new
  
  @page = @agent.get(
    :url =&gt; 'http://www.mcu.es/webISBN/tituloSimpleFilter.do?cache=init&amp;layout=busquedaisbn&amp;language=es',
    :headers =&gt; { 'Accept-Charset' =&gt; 'utf-8' } )
  
  puts @page.body
  </code></pre>