shortnameToUnicode(str)
convert shortnames to native unicode
If you'd like to convert shortnames back to native unicode emoji characters, you can use this function. It's available in both the Javascript and PHP libraries.
Feel free to enter shortnames 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:
JS Snippet:
// <input type="button" value="Convert" onclick="convert()"/> <script type="text/javascript"> function convert() { var input = document.getElementById('inputText').value; var output = joypixels.shortnameToUnicode(input); document.getElementById('outputText').innerHTML = output; } </script>
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->shortnameToUnicode($_POST['inputText']); } ?>