4

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:

  • Altering table and re setting utf8_general_ci for title column
  • calling SET NAMES utf8 before calling procedure.
  • Removing and re-creating stored 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

1 Answer 1

10

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 !!!???

Sign up to request clarification or add additional context in comments.

1 Comment

this is odd ... moved some code to a stored procedure and encountered that encoding issue - even everything was set to UTF8 it seems that we have to provide the encoding in stored procedure parameters as well ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.