How do I encode something in ut8mb4 in Python?
I have two data sets: the data that I transfer to my new MySQL database from Parse, and the data goes forward (this only speaks of my new database). My database is utf8mb4 to store emoji and accented letters.
The first data set is only displayed correctly (when emojis and accents are involved) when I have a script in my python:
MySQLdb.escape_string(unicode(xstr(data.get('message'))).encode('utf-8'))
and when reading from a MySQL database in PHP:
$row["message"] = utf8_encode($row["message"]);
The second data set is only displayed correctly (when emojis and accents are involved) when I DO NOT include the utf8_encode($row["message"]) . I am trying to reconcile them so that both datasets correctly return to my iOS application. Please, help!
python mysql encoding utf-8
user3781236
source share