Le 15/12/2010 14:16, Benedict Verheyen a écrit :
On 15/12/2010 12:34, Romaric DEFAUX wrote:
<snip>
To create these query, I do this :
query = "UPDATE website SET client_name='%s' WHERE ip='%s'" % 
(self.client_name, self.ip)
then self.cursor.execute(query)

Unicode can be tricky.
Don't you have to encode the string again?
I tested this in the interpreter:

a = ("UPDATE website SET client_name='%s'" % "Romariqué 
Admin").decode("iso-8859-15")

print "Query %s " % a.encode("iso-8859-15")
produces UPDATE website SET client_name='Romariqué Admin'

So i would try to encode the query before issuing the self.cursor.execute(query)

Cheers,
Benedict

Thanks for your answer :)

I finally found the solution, I removed the following line from my db connection :
#               con.cursor().execute('SET NAMES \'utf8\';')
#               con.cursor().execute('SET CHARACTER SET utf8;')
#               con.cursor().execute('SET character_set_connection=utf8;')

And now it's working fine !

Thanks for your help !

Romaric

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to