How to specify encoding to fileinput
python
Solution
This is a bug in the fileinput module, it only uses the the encoding information when reading from files, not when reading from standard input :(
Problem
In Python how do I specify the encoding to fileinput.input? I wrote ``` f = fileinput.input(openhook=fileinput.hook_encoded("windows-1252")) ``` but it doesn't work reliably. I get different results for `script.py text.txt` and `script.py < text.txt`