1.现在大多数手机上面都是有emoji,但是在emoji提交到服务器的话 会出现提交上去的问题 大多数都想到用emoji的框架来解决 虽然这样能解决emoji提交的问题,但是ios并不能读取出来。所以整理出一个方案
2.解决方案:1.将emoji的图片和文字转换成utf-8.然后提交到服务器上去 加载数据的时候 我们需要把utf-8转换回来
代码:转换成utf-8 提交到服务器
public String toUTF(String txt){ String result = ""; try { result = URLEncoder.encode(txt,"UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return result;}
代码:加载数据,讲utf-8转换成正常的
public String forUTF(String txt) { String result = ""; try { result = URLDecoder.decode(txt, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return result;}