java 判断字符串什么编码类型
2014-12-11 17:56
369 查看
public static String getEncoding(String str) { String encode = "GB2312"; try { if (str.equals(new String(str.getBytes(encode), encode))) { String s = encode; return s; } } catch (Exception exception) { } encode = "ISO-8859-1"; try { if (str.equals(new String(str.getBytes(encode), encode))) { String s1 = encode; return s1; } } catch (Exception exception1) { } encode = "UTF-8"; try { if (str.equals(new String(str.getBytes(encode), encode))) { String s2 = encode; return s2; } } catch (Exception exception2) { } encode = "GBK"; try { if (str.equals(new String(str.getBytes(encode), encode))) { String s3 = encode; return s3; } } catch (Exception exception3) { } return ""; }
String encode = "ISO-8859-1"; //应用延伸 try { if (customer.equals(new String(customer.getBytes(encode), encode))) { customer = new String(customer.getBytes(encode),"utf-8"); } } catch (Exception exception1) { }
相关文章推荐
- java 判断字符串什么编码类型
- java 判断字符串什么编码类型
- (转)java 判断字符串什么编码类型
- java 判断字符串什么编码类型
- java可供判断某字符串是什么编码的一行代码
- Java进阶(三十) 判断字符串编码类型
- java判断字符串所属的编码类型
- Python【基础:数据类型和变量 字符串和编码 list和tuple 条件判断 循环 dict和set】注意事项(与java,c比较)
- java判断字符串是什么编码
- Java进阶(三十) 判断字符串编码类型
- Java进阶(三十) 判断字符串编码类型
- java 判断字符串编码类型
- java可供判断某字符串是什么编码的一行代码
- 【java】判断字符串编码类型
- C#与Java对比学习:类型判断、类与接口继承、代码规范与编码习惯、常量定义
- JAVA判断文件编码类型
- C#与Java对比学习:类型判断、类与接口继承、代码规范与编码习惯、常量定义
- C#与Java对比学习:类型判断、类与接口继承、代码规范与编码习惯、常量定义
- [java]判断输入字符串类型( 附测试数据)
- JAVA判断文件编码类型