duanping2005
2017-02-16 16:13 阅读 74

使用MySQL在Android应用程序中存储和显示表情符号

I have an application talking to a NodeJS server via socket, that server is talking to PHP via HTTP, and that PHP is using MySQL.

When I try to insert Emojis in a text field, and save it to DB, when I get it back I see "?".

If I copy Emojis from wikipedia (for example ✒️ ❤️

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    duan19805 duan19805 2017-02-16 16:21

    1.)Database : Change Database default collection as **utf8mb4 ** .

    2)Table : Change Table collection as ** CHARACTER SET utf8mb4 COLLATE utf8mb4_bin **.

    Query :                                                                                                                                                         
    
            ALTER TABLE Tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE 
    
    utf8mb4_bin
    

    3)Code :

    insert into tablename (column1,column2,column3,column4,column5,column6,column7) values ('273','3','Hdhdhdh
    点赞 评论 复制链接分享

相关推荐