sqlite fetchall breacking because decoding.
Fredrik Lundh
fredrik at pythonware.com
Wed Jan 9 11:21:07 EST 2008
tyoc wrote:
> The database is not corrupt, I mean Im sure if I do a C program for
> read and print the row, it will get it and just printit and not fail
> like this
well, the database *is* corrupt, since sqlite3 (both the engine and the
Python binding) expects you to use a supported encoding for the data
stored in the database:
http://www.sqlite.org/datatype3.html
http://docs.python.org/lib/node346.html
the fact that you're able to use an API that doesn't care about
encodings at all to violate the database requirements doesn't
necessarily mean that an API that does the right thing is broken...
if you're not able to fix your database, you have to plug in a custom
text_factory handler. this should work:
conn = sqlite3.Connect(...)
conn.text_factory = str
also see:
http://docs.python.org/lib/sqlite3-Connection-Objects.html
</F>
More information about the Python-list
mailing list