Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-01-19 13:19:59

Xavez2
Member
Registered: 2017-09-19
Posts: 16

Emoji’s not allowed in comments field?

A reader of my blog notified me that it is not possible to post emoji’s in the comment field. I couldn’t find anything about it in the forums either. Is this happening to everyone?

Emoji’s seem to be stripped at the point you click Preview, they never even make it to actually posting :-).

Offline

#2 2018-01-19 14:03:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,273
Website GitHub

Re: Emoji’s not allowed in comments field?

Xavez2 wrote #308747:

it is not possible to post emoji’s in the comment field… Emoji’s seem to be stripped at the point you click Preview

Hmmm, something’s afoot here:

  • On Txp 4.6.2:
    • Posting Emoji that are entered as character codes (e.g. 🍻) show up in comment preview AND the final post.
    • Posting Emoji that are copy and pasted from a set show up in comment preview BUT NOT in the final post.
  • On Txp 4.7.0-dev:
    • Posting Emoji that are entered as character codes (e.g. 🍻) show up in comment preview as raw strings (presumably encoded during transit) BUT NOT in the final post (they are there, but encoded as 🍻 in the comment field and are therefore skipped during display).
    • Posting Emoji that are copy and pasted from a set show up in comment preview BUT NOT in the final post: same as on 4.6.2.

If this is indicative of a wider issue and not just my setup, this situation needs fixing somehow. Anybody with some textile / encoding chops want to hazard a guess?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2018-01-19 14:19:38

etc
Developer
Registered: 2010-11-11
Posts: 5,057
Website GitHub

Re: Emoji’s not allowed in comments field?

Have you set utf8mb4 both in db collation and config.php?

Offline

#4 2018-01-19 17:47:32

Xavez2
Member
Registered: 2017-09-19
Posts: 16

Re: Emoji’s not allowed in comments field?

utf8mb4 is set in config.php, but the database is set to utf8_unicode_ci. Since the last debacle, I must say that I am quite hesitant to change anything about that setup :D

Last edited by Xavez2 (2018-01-19 17:47:45)

Offline

#5 2018-01-19 18:15:13

Xavez2
Member
Registered: 2017-09-19
Posts: 16

Re: Emoji’s not allowed in comments field?

Update: Okay so it seems that the original issue is not emoji related at all. It was the `wet_commentmagic` plugin that was blocking anything at all from showing up in the preview.

Terribly sorry for putting you on a sidetrack here :-).

That said, the problem Bloke mentioned still exists. I changed the database to `utf8mb4_unicide_ci` just so that we are checking similar setups. I too see emoji showing up as question marks. The preview is fine, but the actual saved thing is a question mark. As in an actual question mark, not the “missing glyph” icon you can see when you paste something in the forum message field ‘?’.

It also shows as a question mark in the database. But not in the e-mail notification about a new comment.

The same problem is true for articles, by the way, so it’s not just related to comments, but it does seem to be related to the database.

Offline

#6 2018-01-19 18:15:36

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Emoji’s not allowed in comments field?

The database tables all need to be uft8mb4 in order for MySQL to store emojis. I think Ruud created a good plugin a few months ago which can do this for you. Sorry I’d post a link to it but I’m on my iPhone at moment. Should be searchable in the forum.

Offline

#7 2018-01-19 18:21:42

Xavez2
Member
Registered: 2017-09-19
Posts: 16

Re: Emoji’s not allowed in comments field?

philwareham wrote #308762:

The database tables all need to be uft8mb4 in order for MySQL to store emojis. I think Ruud created a good plugin a few months ago which can do this for you. Sorry I’d post a link to it but I’m on my iPhone at moment. Should be searchable in the forum.

I just checked, and they are.

Update: interestingly, the tables are, but not all the fields are . . . Let’s find that plugin.

Last edited by Xavez2 (2018-01-19 18:31:28)

Offline

#8 2018-01-19 18:41:43

Xavez2
Member
Registered: 2017-09-19
Posts: 16

Re: Emoji’s not allowed in comments field?

Excellent, so the problem was indeed that utf8mb4 was not set on all the table columns. I ran ruud’s plugin and that fixed everything. A bit stupid of me to assume that column collations are automatically inherited from tables :-).

Thanks Phil!

Offline

Board footer

Powered by FluxBB