emojionearea: emojioneArea init break some emojies when call it on input with data

Hi!

Thank you for your great work!

Here is my problem - when i call $('.emoji-subject').emojioneArea() on input with some data(text+emojies), it’s break some of emojies code, for example ‘Man pilot’, ‘Cloud Snow’, ‘Cloud Lightning’, and therefore it’s showing like unicode symbols, without transformation to images.

For example:

  1. Init emojioneArea on my empty input
  2. Fill it with some content http://joxi.ru/eAO6140hxXXEX2
  3. Check it’s content lenght via this code (new TextEncoder('utf-8').encode($('.emoji-subject').val())).length, it’s return 60
  4. Save this to db(utf8mb4_unicode_ci)
  5. View record, check length before init emojioneArea, it’s returns 60, everything is OK
  6. init emojioneArea and check length again - it’s returns 51! So, it’s break some parts of unicode. But it’s still looks ok http://joxi.ru/12MxjQ7hMzzKLm
  7. Save data to db, view it again, init emojioneArea and there is no emojies - http://joxi.ru/n2Y05zRuozz5lm String length again returns 51

So, my question is - how can i fix it, because i need all of emojies to work fine.

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

@notgosu Check your database library too. It is not enough that the database column is defined to use utf8mb4_unicode_ci

Your actual sql connection also has to be set to use that charset and collation (often by issuing a ‘set names utf8mb4’ command or whatever mechanism the library recommends