I try following unicode string:u'\u5413\u83d3\u7dab'
Which come from 3 big5hkscs characters.
I run following codes:
data =u'\u5413\u83d3\u7dab'
db = MySQLdb.connect(host=host,db=db,user=user, passwd=passwd,use_unicode=True,charset='utf8')
cur=db.cursor()
cur.execute("insert into t1 (FieldName,f2) values ('a1',%s)", (data,))
select the inserted result:
cur.execute("select FieldName,f2 from t1 where FieldName='a1'")
res = cur.fetchall()
print res
found the extra "\" in the result ???
((u'a3', u'\u5413\\u83d3\u7dab'),)
I have tried different order of the 3 HKSCS characters but found only this order cause this problems.
I had tried the Python2.5, this still happened.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use python2.4.3 and MySQL-python-1.2.1_p2.
I try following unicode string:u'\u5413\u83d3\u7dab'
Which come from 3 big5hkscs characters.
I run following codes:
data =u'\u5413\u83d3\u7dab'
db = MySQLdb.connect(host=host,db=db,user=user, passwd=passwd,use_unicode=True,charset='utf8')
cur=db.cursor()
cur.execute("insert into t1 (FieldName,f2) values ('a1',%s)", (data,))
select the inserted result:
cur.execute("select FieldName,f2 from t1 where FieldName='a1'")
res = cur.fetchall()
print
res
found the extra "\" in the result ???
((u'a3', u'\u5413\\u83d3\u7dab'),)
I have tried different order of the 3 HKSCS characters but found only this order cause this problems.
I had tried the Python2.5, this still happened.