I have a web service which inserts various user input into a MySQL DB.
My DB insert statement uses $db->real_escape_string()
for security on all input.
However this seems to be stripping out emoji references from input, e.g. in the format \ud83d\ude2e
(winking face).
The pertinent DB column has collation utf8_general_ci, as does the table.
Example:
- Before insert: "Foo bar! \ud83d\ude2e"
- After insert (via
real_escape_string()
): "Foo bar! "
Perhaps real_escape_string()
is supposed to pull out things like this, for all I know, and so my problem may be obvious to people more knowledgeable in this field.
How can I allow the retention of the emoji references in the DB insert?