@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 - admins - Discourse Meta.
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.