This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients amaury.forgeotdarc, ezio.melotti, izarf, loewis
Date 2012-12-30.16:23:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356884605.82.0.688741242754.issue6010@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2012-12-30 16:23:25ezio.melottisetrecipients: + ezio.melotti, loewis, amaury.forgeotdarc, izarf
2012-12-30 16:23:25ezio.melottisetmessageid: <1356884605.82.0.688741242754.issue6010@psf.upfronthosting.co.za>
2012-12-30 16:23:25ezio.melottilinkissue6010 messages
2012-12-30 16:23:25ezio.melotticreate