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:

&#127880;=>🎈 or &#x1f388;=>🎈

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 	&#127880; &#x1f388;    </span>


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -