2

I tried to add an emoji in chat box textarea with emoji image input but during the insertion time, i tried to var-dump the data, and that showed as below:

❤️❤️❤️❤️

I did not select any emojiis and inserted into the database

❤️❤️❤️????????❤️

like these, and I also did these steps

1) ALTER DATABASE CHARACTER SET utf8 COLLATE utf8_unicode_ci;

2) ALTER TABLE CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

3) ALTER TABLE MODIFY VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

"thanks for @Timo Huovinen"

Any ways,I want to insert the emoji in database correctly, and after the insertion, the original emoji image should be listed.

Thanks in advance!!!

julie
  • 111
  • 1
  • 2
  • 13
Andrew
  • 840
  • 3
  • 17
  • 43

1 Answers1

0

Parse the emojis as unicode characters before you insert them into your database, after that whenever you retrieve the emoji, just parse them back again.

Here's some info on that: http://crocodillon.com/blog/parsing-emoji-unicode-in-javascript

チャールズ
  • 123
  • 1
  • 7