dongshi4773
dongshi4773
2016-05-24 19:23
浏览 85

Android | PHP | MySql - 将表情符号从Android保存到Mysql服务器

How can I send text with emoji from Android app to server and save it correctly in MySql database?

In Android app I've pass some parametres with post method to php server, then I save it in to MySql database. But I've 2 problems with emoji

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dtjbcda841554
    dtjbcda841554 2016-05-24 19:32
    已采纳

    You can use StringEscapeUtils Apache Library https://commons.apache.org/proper/commons-lang/download_lang.cgi

    For saving the unicodes in database you have to encode them. So send your unicodes to server by encoding like

    StringEscapeUtils.escapeJava(/* string message*/)
    

    For displaying the encoded unicode in android

    StringEscapeUtils.unescapeJava(/* string message*/)
    
    点赞 评论

相关推荐