title: Reading unicode files in python
body: <p>Well I have a file containing unicode "û". This is however not read correctly as shown in the following test case:</p>
  
  <pre><code>print("û")
  with open(r"testfile.txt") as f:
      for line in f:
          print(line)
  </code></pre>
  
  <p>Which outputs:</p>
  
  <pre><code>û
  Ã»
  </code></pre>
  
  <p>The IDE can correctly display the character - yet from reading the file another character is shown.
  If I execute it in the debugger I see that <code>f</code> has as "encoding" cp1252. Not unicode.</p>
  
  <p>So how would I "fix" this?</p>
  
  <p>Opening the file in notepad++ tells me the file really is UTF-8. If I manually change the file to be windows-codepage 1252 it seems to work. But that's not really what I want.</p>