How to specify encoding to fileinput
<p>In Python how do I specify the encoding to <a href="http://docs.python.org/library/fileinput.html" rel="nofollow">fileinput.input</a>?</p>

<p>I wrote</p>

<pre><code>f = fileinput.input(openhook=fileinput.hook_encoded("windows-1252"))
</code></pre>

<p>but it doesn't work reliably. I get different results for <code>script.py text.txt</code> and <code>script.py &lt; text.txt</code></p>
