I have a mySQL table which is set to CHARACTER SET utf8mb4 and a column x which has CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci, and I can run an SQL command directly on the database which inserts a 4-byte unicode character, like
INSERT INTO mytable (x) VALUES ('????');
but when I run the following in web2py, I get a different entry, which looks like ????
sql = u"INSERT INTO mytable (x) VALUES (%s)"
db.executesql(sql, (u'????',))
Is there something I need to set in web2py somewhere to tell it to pass the unicode characters through without alteration?
Addendum: the same ????
entry occurs when I use the DAL too, as in
db.mytable.insert(x=u'????')
/usr/local/lib/python2.7/site-packages/pymysql/cursors.py:165: Warning: (1300, u"Invalid utf8 character string: 'F09F92'") result = self._query(query) /usr/local/lib/python2.7/site-packages/pymysql/cursors.py:165: Warning: (1366, u"Incorrect string value: '\\xF0\\x9F\\x92\\xA9' for column 'search_string' at row 1")
. My pyMySQL is the most recent, 0.8.0. – user2667066