How to open an ascii-encoded file as UTF8?
<p>My files are in US-ASCII and a command like <code>a = file( 'main.html')</code> and <code>a.read()</code> loads them as an ASCII text. How do I get it to load as UTF8?</p>

<p>The problem I am tring to solve is:</p>

<pre><code>UnicodeEncodeError: 'ascii' codec can't encode character u'\xae' in position 38: ordinal not in range(128)
</code></pre>

<p>I was using the content of the files for templating as in <code>template_str.format(attrib=val)</code>. But the string to interpolate is of a superset of ASCII. </p>

<p>Our team's version control and text editors does not care about the encoding. So how do I handle it in the code? </p>
