javascript - twemoji not converting the strings -
i'm trying use twemoji (https://github.com/twitter/twemoji) convert unicode emoji characters.
i have simple page:
<html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <script src="https://twemoji.maxcdn.com/twemoji.min.js"></script> </head> <body> <span> cool string \ud83c\udf88\ud83c\ud83c\udf88\ud83c\ud83c\udf88\ud83c</span> </body> </html>
according documentation when run
twemoji.parse(document.body)
it should run through page , replace unicode characters tags. not happening if take string , put directly function so
twemoji.parse("what cool string \ud83c\udf88\ud83c\ud83c\udf88\ud83c\ud83c\udf88\ud83c");
and run in console in chrome indeed show converted string.
what cool string <img class="emoji" draggable="false" alt="🎈" src="http://twemoji.maxcdn.com/36x36/1f388.png"><img class="emoji" draggable="false" alt="🎈" src="http://twemoji.maxcdn.com/36x36/1f388.png"><img class="emoji" draggable="false" alt="🎈" src="http://twemoji.maxcdn.com/36x36/1f388.png">
the data comes database , it's been inputed using ios app.
any appreciated!
you must use different notation when want write these characters in html:
🎈
=>🎈 or 🎈
=>🎈
see: http://www.charbase.com/1f388-unicode-balloon
twemoji.parse(document.body)
<script src="https://twemoji.maxcdn.com/twemoji.min.js"></script> <span> cool string 🎈 🎈 </span>
Comments
Post a Comment