title: Getting latin1 instead of UTF-8 with CGI::Application
body: <p>I am using <code>CGI::Application</code> with UTF-8 data.</p>
  
  <p>In the HTML have I set encoding to UTF-8 like so</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html dir="ltr"&gt;
    &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
    &lt;/head&gt;
    &lt;body&gt;
  </code></pre>
  
  <p>but the output is treated as latin1, as special characters are displayed as 2 characters.</p>
  
  <p>Page Info in Firefox says the page is encoded with <code>ISO-8859-1</code> despite the HTML header.</p>
  
  <p>I have only been able to find these <a href="http://www.perlmonks.org/?node_id=670272" rel="nofollow">two</a> <a href="http://dysphoria.net/2006/02/05/utf-8-a-go-go/" rel="nofollow">posts</a> about the problem, but they are old and very complicated.</p>
  
  <p>Anyone that have solved this problem?</p>
  
  <p><strong>Update</strong>: Here are the HTTP header from FireBug.</p>
  
  <pre><code>Response Headers
  Date    Tue, 26 Apr 2011 09:53:24 GMT
  Server  Apache/2.2.3 (CentOS)
  Connection  close
  Transfer-Encoding   chunked
  Content-Type    text/html; charset=ISO-8859-1
  
  Request Headers
  Host    example.com
  User-Agent  Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101 Firefox/4.0
  Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language en-gb,en;q=0.5
  Accept-Encoding gzip, deflate
  Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Keep-Alive  115
  Connection  keep-alive
  </code></pre>
  
  <p>I noticed that if I force UTF-8 by <code>FireFox-&gt;Web Developer-&gt;Character Encoding-&gt;Unicode (UTF-8)</code>, if looks correct.</p>