sim*_*994 2 php mysql android emoji
如何将带有表情符号的文本从Android应用程序发送到服务器并将其正确保存在MySql数据库中?
在Android应用程序中,我将一些带有post方法的参数传递给php服务器,然后将其保存到MySql数据库中.但是表情符号我有两个问题
Warning: #1366 Incorrect string value: '\xF0\x9F\x98\x8D' for column 'name' at row 1.表和字段具有utf8mb4_bin排序规则.您可以使用StringEscapeUtils Apache Library https://commons.apache.org/proper/commons-lang/download_lang.cgi
要在数据库中保存unicodes,您必须对它们进行编码.所以通过编码来将你的unicodes发送到服务器
StringEscapeUtils.escapeJava(/* string message*/)
Run Code Online (Sandbox Code Playgroud)
用于在android中显示编码的unicode
StringEscapeUtils.unescapeJava(/* string message*/)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1171 次 |
| 最近记录: |