title: Python UnicodeDecodeError when writing German letters
body: <p>I've been banging my head on this error for some time now and I can't seem to find a solution anywhere on SO, even though there are similar questions.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>f = codecs.open(path, "a", encoding="utf-8")
  value = "Bitte überprüfen"
  f.write(("\"%s\" = \"%s\";\n" % ("no_internet", value)).encode("utf-8"))
  </code></pre>
  
  <p>And what I get as en error is:</p>
  
  <pre><code>UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128)
  </code></pre>
  
  <p>Why ascii if I say utf-8? I would really appreciate any help.</p>