I have a database that has a stored procedure that I call it in my python script.
until yesterday there were no problem with it.
but yesterday my database server had a problem and restored the database.
now I'm getting this warning from the same code:
Warning: Incorrect string value: '\xD9\x88\xD8\xB2\xDB\x8C...' for column 'title' at row 1
I checked some encodings in DB :
In INFORMATION_SCHEMA.COLUMNS
:
+--------------+--------------------+
| COLUMN_NAME | CHARACTER_SET_NAME |
+--------------+--------------------+
| title | utf8 |
+--------------+--------------------+
Database collation: latin1_swedish_ci
Table collation: utf8_general_ci
Column collation: utf8_general_ci
Server charset: UTF-8 Unicode (utf8)
(All are same as before!!)
and I'm connecting using this:
self.con=mdb.connect(host=self.host, user=self.user, passwd=self.passwd, db=self.dbname,use_unicode=True, charset="utf8");
and variable title
is unicode.
I tried:
utf8_general_ci
for title
columnSET NAMES utf8
before calling procedure. None worked!!! :-(
I executed an insert
query on a temporary table with Unicode content and it worked without that warning!!!
What is the problem?
how can I fix this?
Thanks
Problem solved!
I added CHARACTER SET utf8
to my stored procedure's VARCHAR arguments and problem solved:
..., IN `title` VARCHAR(255) CHARSET utf8,...
But yet I wonder why before restoring DB there was no problem !!!???
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With