java 判断字符串编码类型
来源:互联网 发布:淘宝联盟转链工具 编辑:程序博客网 时间:2024/06/05 18:40
[java] view plain copy print?
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 "";
}
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 "";
}
阅读全文
0 0
- 【java】判断字符串编码类型
- java 判断字符串编码类型
- java 判断字符串什么编码类型
- java 判断字符串什么编码类型
- java 判断字符串什么编码类型
- (转)java 判断字符串什么编码类型
- java判断字符串所属的编码类型
- Java进阶(三十) 判断字符串编码类型
- Java进阶(三十) 判断字符串编码类型
- 判断字符串编码类型
- 判断字符串编码类型
- java判断字符串编码
- JAVA判断字符串编码
- JAVA判断文件编码类型
- JAVA判断文件编码类型
- JAVA判断文件编码类型
- 判断字符串的编码类型(GBK / UTF8)
- 判断字符串的编码类型(GBK / UTF8)
- html之div和span
- JavaScript DOM扩展
- imageview和imagebutton
- HDU 6144 Arithmetic of Bomb(字符串+大数取余模板)
- 元标签
- java 判断字符串编码类型
- tomcat请求处理分析(一) 启动container实例
- Binder听课记录
- 【OpenGL】着色器 Shader
- css之表格
- python3编码问题(网络流数据写入到本地出错问题)
- kaldi学习第三天
- PyQt5的多线程
- html定义列表