3

I have a android app, which messages workds with emoji. Saved message with emojis is diaplayed ok on android after fetching from mysql via json. Now I want to display same message with emojis on web script. Found JS lib https://github.com/iamcal/js-emoji but cant make it work. Anyone has a ready to use implementation of it? Sample db record look like this:

Unii \uD83D\uDE02\uD83D\uDE03\uD83D\uDE2E\uD83D\uDE25\uD83D\uDE23\uD83D\uDE0F

These are android emojis. Hot make the work on web?

2 Answers2

0

First of all coping files will not make it work ;) you need also do some configuration:

first of all download that repo

Basically check browser console if it has any errors. Most common erros is that there will be en empty emoji.prototype.data on line 519 in emoji.js file - so you need to be sure the grunt task finishes correctly without errors.

born2fr4g
  • 1,290
  • 4
  • 27
  • 38
0

Figured it out. The basic configuration from https://github.com/iamcal/js-emoji is enough to make js script to work. The problem was the string encoding. Android uses "Unicode escape sequences" to store specials characters in strings. It works great on mobile, but php has issues with it. Therefore we need to convert Unicode escape sequences with php working version. The converted version of previous db rec

Unii \ud83d\ude02\ud83d\ude03\ud83d\ude2e\ud83d\ude25\ud83d\ude23\ud83d\ude0f

Php convert functions can be found @ How to decode Unicode escape sequences like "\u00ed" to proper UTF-8 encoded characters?

Community
  • 1
  • 1