Setting the encoding in pysqlite2

Renzo renzoPUNTOgiust at email.it
Thu Aug 25 04:34:51 EDT 2005


Michele Simionato ha scritto:
> An easy question, but I don't find the answer in the docs :-(
> I have a sqlite3 database containing accented characters (latin-1).
> How do I set the right encoding? For instance if I do this:
> 

Hi,
i usually use this "string" method:

encode([encoding[,errors]])

An example:

cur.execute("""
    insert into tab(
                field1,
                field2)
         values (?,?)
             """ , (myvar1.encode('utf8'),\
                    myvar2.encode('utf8')))

Bye,
Renzo



More information about the Python-list mailing list