title: Haskell character encoding
body: <p>I'm writing a Haskell program which generates an XML file. Apparently it is considered traditional to specify the character encoding in the <code>&lt;?xml?&gt;</code> tag. My question is, what's the best thing to do?</p>
  
  <ol>
  <li><p>Use <code>hGetEncoding</code> to look up the file's encoding, and record that in the XML file header.</p></li>
  <li><p>Use <code>hSetEncoding</code> to <em>specify</em> which encoding I want, and then hard-code that into the XML file header.</p></li>
  </ol>
  
  <p>The first option appears to have the problem that I'd need a way to translate what Haskell calls the encoding into what XML calls it. The second has the problem that unless I can figure out what encoding all the other applications on my PC use, the file will be unreadable (except to web browsers).</p>
  
  <p>All of which is slightly baffling, because I almost certainly don't even <em>need</em> Unicode anyway. I'm just writing plain ordinary English text with no special characters... (Ah, but the £ sign varies by encoding, doesn't it? <em>sigh</em>)</p>