How Can I Use Emojis in Dreamfactory?

If I store Emoji’s in Mysql (:grinning::peach: ) it Store like ???.
My phpmyadmin version is > 4.4.13

How Can I solve it.?

For Reference:

My Post body content in api_doc

“resource”: [{
“user_id”: 1,
“post_id”: 1,
“comment”: “Hi Hari​:grinning::peach:”,
“like_count”: 0,
“created”: 145,
“reply_id”: “”
}]

But in comment field it insert like ???

Emojis are not “stored” in the database, but a text representation of them. Probably you’ve noticed that in order to include emojis in your message you saw the word “grinning” between two semicolons.

You should store them as text, and then process your output replacing the emoji code for an image.

For a larger list of emoji codes refer to http://www.emoji-cheat-sheet.com/.

Hi Elvis,

Thanks for Your Response, I use my post data like

$post_method= $platform[‘api’]->post;
$postbody=’{ “resource”: [ ‘.json_encode($resource).’ ] }’;
$payload = json_decode($postbody, true);
$insert_reply = $post_method(‘servicename/_table/comment’,$payload);

In my table, I was set to comment column as utf8mb4_unicode_ci. If I manually insert the emojis in DB in store perfectly But if I insert by using above code stores like ???

How Can I solve this issue

–Hari

This seems not to be anything related to DreamFactory, but to the encoding you’re sending the data to your DF instance. Just make sure everything in your setup is configured to use the very same encoding - from the text file format in your text editor to the forms in your html file. Take a look at http://www.w3schools.com/tags/att_form_accept_charset.asp to make sure you’re using the appropriate encoding to perform the POST request to DF.

1 Like

Have you ever resolved this issue?
I have the same one right now.
Only after I set the collumn encoding to uft8mb_unicode_ci could I put emojis directly into the DB.

When POSTing, the content-type is explicitly set to uft-8. It won’t even work from the /test_rest.html, where it is also utf-8.

Emojis, that are sent TO df are replaced wit “???”.
Emojis, that I entered into the db and are coming FROM df, are replaced with “?”.

The solution for me was to also set the connection character set.

In Dreamfactory, go to Servicesmysql.
Then in the Config tab, set Character Set to utf8mb4 and Character Set Collation to utf8mb4_unicode_ci.