Hi all,

Since yesterday I'm working on an encoding problem, I become crazy now :)
Could you please help me ?

Here's the description of the problem :

I've got two table in a MysqlDB :
history_website and website
The important column in them are :
history_website.message (varchar(255), encoding = utf8_general_ci)
website.client_name (varchar(255), encoding = utf8_general_ci)

Why :
1° ) INSERT INTO history_website (time, ip, servername, message) VALUES ('1292411324.22', '192.168.2.15', 'system_server_test.audaxis.com', 'client_name UPDATED from Romariqu to Romariqué Admin\n')
is working perfectly when
2°) UPDATE website SET client_name='Romariqué Admin\n' WHERE ip='192.168.2.15'
is producing error :
Warning: Incorrect string value: '\xE9 Admi...' for column 'client_name' at row 1 ???

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)

query = "INSERT INTO history_website (time, ip, servername, message) VALUES ('%s', '%s', '%s', '%s')" % (now, self.ip, self.servername, message)" where message = "client_name UPDATED from %s to %s" % (old_website.client_name, self.client_name)

They're both string :
type(message) = <type 'str'>
type(client_name) = <type 'str'>

My default encoding is sys.setdefaultencoding('utf-8')

In my opinion, it should not work for both or work for both, no ? This is strange that it's working only for one...

Romaric

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

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

Reply via email to