title: Error when inserting strings into SQLite database from Python code
body: <p>When I want to insert a string from <code>Python</code> code to <code>SQLite</code> database I get this error:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>This is the insert statement:</p>
  
  <pre><code>cur.execute("insert into links (url, title, ...) values (:url, :title, ...)", locals())
  </code></pre>
  
  <p>The string came into existence as follows:</p>
  
  <pre><code>soup = BeautifulSoup(html.read(), fromEncoding="utf-8")
  html.close()
  for i in soup.findAll('a'):
    url = i['href']
    title = i.renderContents()
  </code></pre>
  
  <p>Could you advise me how to insert the string into <code>SQLite database</code>?</p>
  
  <p>EDIT: I found out that <code>url</code> string was OK when inserting to another table. The type of <code>url</code> string was <code>unicode</code>. The problem is when inserting <code>title</code> string. The type of <code>title</code> string is <code>str</code>.</p>
  
  <p>I tried:</p>
  
  <pre><code>title = unicode(i.renderContents())
  </code></pre>
  
  <p>but this ends with error:</p>
  
  <blockquote>
    <p>UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
    44: ordinal not in range(128)</p>
  </blockquote>
  
  <p>thank you</p>