Sqlite3 textfactory and user-defined function

Gerhard Häring gh at ghaering.de
Sat Jun 21 18:25:18 EDT 2008


jeff_d_harper at hotmail.com wrote:
> I've run into a problem with text encoding in the Sqlite3 module.  I
> think it may be a bug.  By default sqlite3 converts strings in the
> database from UTF-8 to unicode.  This conversion can be controlled by
> changing the connection's text_factory.
> 
> I have a database that stores strings in 8-bit ISO-8859.  So, I set
> the text_factory to do no conversion.  In my database I use user
> defined functions.  I noticed that even when I set text_factory =
> lambda x:x, it appears to do UTF-8 to unicode conversion on strings
> that are passed to my user defined function. [...]

I've answered the same question on the pysqlite mailing list a few weeks
back:

Thread "Trouble with create_function interface to sqlite"

http://itsystementwicklung.de/pipermail/list-pysqlite/2008-May/000062.html

-- Gerhard



More information about the Python-list mailing list