Incorrect warning string value when calling stored procedure in python

I have a database with a stored procedure that I call it in my python script.
until yesterday there was no problem with this.
but yesterday my database server had a problem and restored the database.
now i am 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:
Q INFORMATION_SCHEMA.COLUMNS

:

+--------------+--------------------+
| COLUMN_NAME  | CHARACTER_SET_NAME |
+--------------+--------------------+
| title        | utf8               |
+--------------+--------------------+

      

Database Mapping: latin1_swedish_ci


Sort Table: utf8_general_ci


Column Mapping: utf8_general_ci


Server Code: UTF-8 Unicode (utf8)


(Same as before!)

and I am 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 the variable title

is unicode.

I tried:

  • Changing the table and settings utf8_general_ci

    for a columntitle

  • call SET NAMES utf8

    before calling the procedure.
  • Deleting and Re-creating a Stored Procedure

Nothing worked !!! :-(


I ran a query insert

on a temporary table with Unicode content and it worked without this warning !!!


What is the problem?
How can I fix this?

thank

+3


source to share


1 answer


Problem solved!
I added CHARACTER SET utf8

to my stored procedure. VARCHAR arguments and problem solved:

..., IN `title` VARCHAR(255) CHARSET utf8,...

      



But still I wonder why there were no problems before the database was restored !!! ???

+7


source







All Articles