Message178584
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.) |
|
Date |
User |
Action |
Args |
2012-12-30 16:23:25 | ezio.melotti | set | recipients:
+ ezio.melotti, loewis, amaury.forgeotdarc, izarf |
2012-12-30 16:23:25 | ezio.melotti | set | messageid: <1356884605.82.0.688741242754.issue6010@psf.upfronthosting.co.za> |
2012-12-30 16:23:25 | ezio.melotti | link | issue6010 messages |
2012-12-30 16:23:25 | ezio.melotti | create | |
|