0

When emoticons represented in unicode format are used as input to html() method, the output is not always as expected. For example, below is my code -

var smilingEyes = "\ud83d\ude01";
el.html(smilingEyes); // This works and displays the emoji correctly

var unicodeFormatOfSmiley = data.unicodeFormatFromServer; // The value of this is - \ud83d\ude01
el.html(unicodeFormatOfSmiley); // This does not work!!!!!!!!

The problem arises when I get the emoji represented in unicode format from the backend server. I checked, re-checked and again checked the unicode sent from the server. The server is sending the correct unicode representation of the emoji and when I use this in the html() element, instead of displaying the emoji, the unicode representation of the emoji is displayed.

Any help, suggestion is greatly appreciated.

2
  • Is the server data URL or HTML encoded? Is it sent UTF-8 or some other encoding? Commented Jun 8, 2016 at 16:10
  • Can you try adding quotes var unicodeFormatOfSmiley ="+ data.unicodeFormatFromServer+"; Commented Jun 8, 2016 at 16:16

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.