title: Python + PostgreSQL + strange ascii = UTF8 encoding error
body: <p>I have ascii strings which contain the character <code>"\x80"</code> to represent the euro symbol:</p>
  
  <pre><code>&gt;&gt;&gt; print "\x80"
  €
  </code></pre>
  
  <p>When inserting string data containing this character into my database, I get:</p>
  
  <pre><code>psycopg2.DataError: invalid byte sequence for encoding "UTF8": 0x80
  HINT:  This error can also happen if the byte sequence does not match the encodi
  ng expected by the server, which is controlled by "client_encoding".
  </code></pre>
  
  <p>I'm a unicode newbie. How can I convert my strings containing <code>"\x80"</code> to valid UTF-8 containing that same euro symbol? I've tried calling <code>.encode</code> and <code>.decode</code> on various strings, but run into errors:</p>
  
  <pre><code>&gt;&gt;&gt; "\x80".encode("utf-8")
  Traceback (most recent call last):
    File "&lt;pyshell#14&gt;", line 1, in &lt;module&gt;
      "\x80".encode("utf-8")
  UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
  </code></pre>