title: sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings
body: <p>Using SQLite3 in Python, I am trying to store a compressed version of a snippet of UTF-8 HTML code.</p>
  
  <p>Code looks like this:</p>
  
  <pre><code>...
  c = connection.cursor()
  c.execute('create table blah (cid integer primary key,html blob)')
  ...
  c.execute('insert or ignore into blah values (?, ?)',(cid, zlib.compress(html)))
  </code></pre>
  
  <p>At which point at get the error:</p>
  
  <pre><code>sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
  </code></pre>
  
  <p>If I use 'text' rather than 'blob' and don't compress the HTML snippet, it works all fine (db is to large though). When I use 'blob' and compress via Python zlib library, I get the above error message. I looked around but couldn't find a simple answer for this one.</p>