Ezio Melotti added the comment:

While trying to reproduce the issue I noticed this while inserting values:

import sqlite3
db = sqlite3.connect(':memory:')
cur = db.cursor()
cur.execute("create table foo (x)")
# this works fine
cur.execute(u"insert into foo values ('café')".encode('latin1'))
# this fails
cur.execute(u"insert into foo values (?)", (u'café'.encode('latin1'),))
# this fails too
cur.execute("insert into foo values (?)", (u'café'.encode('latin1'),))

The error is:
 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.

Should this be reported in the first case too? (This would be 
backward-incompatible, but, unless it's expected to work, we can always add a 
warning.)

----------
components: +Library (Lib) -None
nosy: +ezio.melotti
versions: +Python 2.7 -Python 2.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6010>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to