I'm having trouble to get unicode values out of mysql queries.
I am working on the following code:
>>> from MySQLdb import connect
>>> from MySQLdb.cursors import DictCursor
>>> con = connect(
passwd = "****",
db = 'my_db',
user = "db_user",
host = "localhost",
cursorclass = DictCursor,
use_unicode=True,
charset="utf8"
)
>>> cursor = con.cursor ()
>>> cursor.execute (u'Select * from basic_applet')
>>> res = cursor.fetchall()
>>> print(res)
({'Title_de': 'test title', .... })
>>> type(res[0]['Title_de'])
<type 'str'>
But it is not returning unicode.
In my table structure, Title_de is set as unicode.
IDbasic_applet int(10)...
Title_de varchar(75) utf8_bin
I am not able to figure out the problem. Can anyone please tell me how to fix this?