Emoji One Labs

::toShort($str)

convert native unicode emoji to shortnames

Our recommendation is to unify all user inputted text by converting native unicode emoji, such as those inputted by mobile devices, to their corresponding shortnames. This demo shows you how to use the ::toShort($str) PHP function provided in our toolkit to do just that.

Feel free to enter native unicode emoji in the input below to test the conversion process. For a complete list of emoji and their shortnames check out emoji.codes.

Note: Once you start dealing with native unicode characters server side, it's important to ensure that your web stack is set up to handle UTF-8 character encoding. That is outside of the scope of our demos, but a quick Google Search will guide you in the right direction.

Input:

Output:

PHP Snippet:

<?php
    // include the PHP library (if not autoloaded)
    require('./../lib/php/autoload.php');

    if(isset($_POST['inputText'])) {
      echo Emojione\Emojione::toShort($_POST['inputText']);
    }
?>