Reputation: 58
On posting my newsfeed message including unicodes of images e.g. \\ud83d\\ude01\\ud83d\\ude06\\ud83d\\ude03\\ud83d\\ude04test
, it displays \�\�\�\�\�\�\�\�test
. I am using 'Emojione' javascript library for converting the unicode to Image."
After calling ajax, I render newsfeed data by converting the unicode data by calling function unescapeUnicode(emojiRegExp)
function unescapeUnicode( str ) {
return str.replace( /\\u([a-fA-F0-9]{4})/g, function(g, m1) {
return String.fromCharCode(parseInt(m1, 16));
});
}
I expect the output '😁😆😃😄test', but the actual output is '"\�\�\�\�\�\�\�\�test"'
Upvotes: 1
Views: 40