Emoji CoDec

Categories

Component ID

2509974

Component name

Emoji CoDec

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Emoji CoDec (COder/DECoder) uses PHP-Emoji library to overcome a serious problem on Drupal and MySQL: Emoji characters in a node content or title cause a fatal error and breaks the site (see this, or this).

Emojis are actually Unicode Characters, only MySQL and Drupal are not prepared to deal with them. Therefore, we have to encode those characters in a way our DB can store them, then we must be able to revert the process.

That's what this module does, using PHP-Emoji library.

Requirements

PHP-Emoji library.

How is it encoded?

The library uses a very simple trick: It generates a SPAN tag, then it adds two class names to this tag: "emoji" and "emoji-[number]". It's completely safe, as long as your system does not strip those tags. Remember to check your Input filter configuration to be sure you allow SPANs!

How does it render?

On rendering process, this encoding is reverted and the characters go back to its default state, so they are rendered natively. That means, iOS users will see them "the iOS way", Windows users will see them "the Windows way" and so on.

What's the status of this module?

At this moment, this module is just an experiment, a "proof of concept", the minimum module I could upload to check if Emojis could be properly saved and rendered. It just processes title and body fields of any content type upon saving and rendering, offering no configuration options.