判断字符串编码类型

来源:互联网 发布:linux怎么安装ftp服务 编辑:程序博客网 时间:2024/05/16 17:40
    public static String getEncoding(String str) {          String encode = "GBK";          try {              if (str.equals(new String(str.getBytes(encode), encode))) {                  return encode;                }          } catch (Exception exception) { ... }            encode = "UTF-8"          encode = "SJIS"      }


原创粉丝点击