android String 类型转换成UTF-8格式
时间:2014-03-10 12:18:57
收藏:0
阅读:2144
在android开发中,有时候会遇到汉字乱码的问题,在这个时候,吧String串加一个编码格式转换,转换成UTF-8的格式就可以了
1 public static String toUtf8(String str) { 2 String result = null; 3 try { 4 result = new String(str.getBytes("UTF-8"), "UTF-8"); 5 } catch (UnsupportedEncodingException e) { 6 // TODO Auto-generated catch block 7 e.printStackTrace(); 8 } 9 return result; 10 }
就是这么简单的一个函数
android String 类型转换成UTF-8格式,布布扣,bubuko.com
原文:http://www.cnblogs.com/cwr941012/p/3590800.html
评论(0)
