Android乱码类型判断
来源:互联网 发布:win域名无法备案 编辑:程序博客网 时间:2024/06/07 06:41
public static void testCharset(String datastr){
try {
String temp = new String(datastr.getBytes(), "GBK");
Log.v("TestCharset","****** getBytes() -> GBK ******\n"+temp);
temp = new String(datastr.getBytes("GBK"), "UTF-8");
Log.v("TestCharset","****** GBK -> UTF-8 *******\n"+temp);
temp = new String(datastr.getBytes("GBK"), "ISO-8859-1");
Log.v("TestCharset","****** GBK -> ISO-8859-1 *******\n"+temp);
temp = new String(datastr.getBytes("ISO-8859-1"), "UTF-8");
Log.v("TestCharset","****** ISO-8859-1 -> UTF-8 *******\n"+temp);
temp = new String(datastr.getBytes("ISO-8859-1"), "GBK");
Log.v("TestCharset","****** ISO-8859-1 -> GBK *******\n"+temp);
temp = new String(datastr.getBytes("UTF-8"), "GBK");
Log.v("TestCharset","****** UTF-8 -> GBK *******\n"+temp);
temp = new String(datastr.getBytes("UTF-8"), "ISO-8859-1");
Log.v("TestCharset","****** UTF-8 -> ISO-8859-1 *******\n"+temp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
try {
String temp = new String(datastr.getBytes(), "GBK");
Log.v("TestCharset","****** getBytes() -> GBK ******\n"+temp);
temp = new String(datastr.getBytes("GBK"), "UTF-8");
Log.v("TestCharset","****** GBK -> UTF-8 *******\n"+temp);
temp = new String(datastr.getBytes("GBK"), "ISO-8859-1");
Log.v("TestCharset","****** GBK -> ISO-8859-1 *******\n"+temp);
temp = new String(datastr.getBytes("ISO-8859-1"), "UTF-8");
Log.v("TestCharset","****** ISO-8859-1 -> UTF-8 *******\n"+temp);
temp = new String(datastr.getBytes("ISO-8859-1"), "GBK");
Log.v("TestCharset","****** ISO-8859-1 -> GBK *******\n"+temp);
temp = new String(datastr.getBytes("UTF-8"), "GBK");
Log.v("TestCharset","****** UTF-8 -> GBK *******\n"+temp);
temp = new String(datastr.getBytes("UTF-8"), "ISO-8859-1");
Log.v("TestCharset","****** UTF-8 -> ISO-8859-1 *******\n"+temp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
0 0
- Android乱码类型判断
- Android网络类型判断
- android 判断 网络 类型
- Android 判断网络类型
- Android网络类型判断
- Android 网络类型判断
- Android网络类型判断
- 彻底解决android读取中文txt的乱码(自动判断文档类型并转码
- 彻底解决android读取中文txt,lrc的乱码(自动判断文档类型并转码)
- 彻底解决android读取中文txt,lrc的乱码(自动判断文档类型并转码)
- android读取中文txt,lrc的乱码(自动判断文档类型并转码)
- 彻底解决android读取中文txt,lrc的乱码(自动判断文档类型并转码)
- 彻底解决android读取中文txt,lrc的乱码(自动判断文档类型并转码)
- 彻底解决android读取中文txt的乱码(自动判断文档类型并转码)
- 解决android读取中文txt的乱码(自动判断文档类型并转码
- android判断接入点类型
- android判断网络的类型
- android判断用户网络类型
- 树形菜单
- 不同等级标签的对比
- 使用 TortoiseGit 连接 github
- gridview开发遇到的一些问题
- Redis的基本操作及其常用命令
- Android乱码类型判断
- requestDisallowInterceptTouchEvent(true)的使用
- 什么是SVG和SVG常用的形状
- jsp获取路径方法
- 在mac上从外置硬盘启动windows教程
- HTML第二章框架
- 第七周-闰年
- Elasticsearch中的segment理解
- CFGym 100803DSpace Golf+物理(数学)计算