@Canapin Hey
Just an update on this one.
The issue here arises when
- You have enabled the āfull post contentā setting in wp-discourse
- Youāve created a post in wordpress with at least one line of content before the insertion of emojis.
Firstly, could you just confirm with me that thatās what youāve done in this case (particularly the āfull post contentā setting)?
In these circumstances the wp-discourse plugin sends html over to Discourse, which is imported as a topic embed. A few different issues, including this one, can arise when Discourse attempts to process the html when creating a post. For example, another issue that arises is Fix broken images for posts created by the WP Discourse and RSS plugins.
On the technical front (as I know youāre technical
), you can see the issue directly if you attempt to use the relevant Discourse ruby class to parse a html string with unicode emojis.
Technical detail of issue
rails c
PrettyText.cook("<p>This is the sentence before the emojis</p><div>š¦š¦š¦š¦</div>")
=> "<p>This is the sentence before the emojis</p><div>š¦š¦š¦š¦</div>"
versus
rails c
PrettyText.cook("š¦š¦š¦š¦")
=> "<p><img src=\"/images/emoji/twitter/fox_face.png?v=9\" title=\":fox_face:\" class=\"emoji\" alt=\":fox_face:\"><img src=\"/images/emoji/twitter/fox_face.png?v=9\" title=\":fox_face:\" class=\"emoji\" alt=\":fox_face:\"><img src=\"/images/emoji/twitter/fox_face.png?v=9\" title=\":fox_face:\" class=\"emoji\" alt=\":fox_face:\"><img src=\"/images/emoji/twitter/fox_face.png?v=9\" title=\":fox_face:\" class=\"emoji\" alt=\":fox_face:\"></p>"
So what are we doing about it?
Generally speaking, some issues in Wordpress full post html > Discourse post conversion are not unexpected. The record of the Wordpress post on Discourse is just that, a record of the post.
That said, @simon and I are actively looking at improving that process in both wp-discourse and Discourse itself, with an appropriate prioritization. Weāre going to focus on a few other things in this respect (e.g. the broken images issue mentioned above), before we get to this one. So youāll need to sit tight for an official fix on this one for a bit.