JoyPixels Labs

version 8.0

ASCIItoShortname($str)

convert ASCII characters 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.

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
            namespace JoyPixels;

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

            $client = new Client(new Ruleset());

            if(isset($_POST['inputText'])) {
              echo $client->toShort($_POST['inputText']);
            }
        ?>