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 loewis
Recipients amaury.forgeotdarc, izarf, loewis
Date 2009-05-13.18:37:31
SpamBayes Score 2.263874e-06
Marked as misclassified No
Message-id <>
This is not a bug. By default, pysqlite decodes all strings to Unicode,
assuming UTF-8 encoding (which SQLite assumes when parsing statements).

To override this default, you need to change the connection's text_factory:

py> import sqlite3
py> db = sqlite3.connect(':memory:')
py> db.text_factory = str
py> cur = db.cursor()
py> cur.execute("create table foo (x)")
<sqlite3.Cursor object at 0xb7cfb500>
py> cur.execute("insert into foo values ('café')")
<sqlite3.Cursor object at 0xb7cfb500>
py> cur.execute("select * from foo")
<sqlite3.Cursor object at 0xb7cfb500>
py> _.fetchall()
Date User Action Args
2009-05-13 18:37:34loewissetrecipients: + loewis, amaury.forgeotdarc, izarf
2009-05-13 18:37:34loewissetmessageid: <>
2009-05-13 18:37:32loewislinkissue6010 messages
2009-05-13 18:37:31loewiscreate