I'm building a simple tool that generates some custom HTML based on data from the website. After, we can simply publish this content to a Facebook page via the Facebook SDK (API).
The following PHP code is an excerpt of how the $content is set up:
$content = '';
$content .= '📍 The address<br>';
$content .= '🛀 2 bathrooms<br>';
Via some AJAX code, this $content is shown as HTML in a div on the page, where the user can further edit the texts.
Then, the user can click on 'share' and via AJAX the post is published to Facebook. I use the following PHP code to format the content before it is passed to the FB API:
$content = str_replace('<br>',chr(10),$content);
$content = html_entity_decode($content);
$content = strip_tags($content);
The problem is that the emojis are not showing on Facebook. When I test it with
$content = html_entity_decode('️');
Then the emoji is showing correctly, but it seems that it's not working because I get $content via AJAX/Jquery with
var content = $('#content').html();
And then pass it through AJAX.
So I suppose there is a formatting issue, but I can't wait a way to fix it..
EDIT: because the content is first shown on the page in a div, the emojis are turned into <img draggable="false" role="img" alt="