I want to get a string that could possibly contain a UCS-2 or UCS-4 emoji code into a MySQL database. The JSON response I get in Python that needs to be sent to MySQL is from the following pseudocode:
response = requests.post("URL", headers=headers, data=data)
responseDict = response.json()
strings = responseDict["data_with_emojis"] # data looks like u'key': u'value', ...
Python's native str() function fails on emojis, and I can't seem to figure out how to substitute them out of the raw data.
Any solution to getting these codes stringified will suffice, but ideally I'd like to remove/replace them on the Python side of my system. I don't however mind using str_replace()
with regex in PHP to remove emoji stringified codes. Point is, these emojis need to be GONE.
How can I remove them?
(I fear my understanding of Unicode and charsets in general are the root of the issue here.)