duanping2005 2017-02-16 16:13
浏览 79
已采纳

使用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 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
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?