判断字符串的编码
来源:互联网 发布:php curl urlencode 编辑:程序博客网 时间:2024/05/16 19:20
/**
- * 判断字符串的编码
- *
- * @param str
- * @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
- 判断字符串的编码
- 判断字符串的编码格式
- 判断字符串的编码类型(GBK / UTF8)
- 判断字符串的编码类型(GBK / UTF8)
- php判断 获取字符串的编码类型
- java判断字符串所属的编码类型
- Python判断字符串编码以及编码的转换
- python字符串编码判断
- java判断字符串编码
- 判断字符串编码类型
- 判断字符串编码类型
- JAVA判断字符串编码
- python判断字符串编码——使用chardet判断字符串编码的方法
- java怎么判断byte[]的原字符串的编码?
- 判断字符串是什么编码(转)
- 判断字符串是否UTF8编码
- JAVA如何判断字符串编码
- 【java】判断字符串编码类型
- 总结2013,展望2014
- 最小生成树问题
- DOS删除服务
- 排序(一)
- javascript禁用浏览器滚动条
- 判断字符串的编码
- [20140101_Examploe04]简单的Person类
- Android Animation之初涉动画
- 虚拟主机的配置
- wpf相关好资源(转)
- STM32调试错误
- MySQL数据库乱码-Linux下乱码问题
- C可变参数列表
- 设计模式汇总