
public static String getEncoding(String str) {
String encode = "GB2312";
try {
if (strequals(new String(strgetBytes(encode), encode))) { //判断是不是GB2312
String s = encode;
return s; //是的话,返回“GB2312“,以下代码同理
}
} catch (Exception exception) {
}
encode = "ISO-8859-1";
try {
if (strequals(new String(strgetBytes(encode), encode))) { //判断是不是ISO-8859-1
String s1 = encode;
return s1;
}
} catch (Exception exception1) {
}
encode = "UTF-8";
try {
if (strequals(new String(strgetBytes(encode), encode))) { //判断是不是UTF-8
String s2 = encode;
return s2;
}
} catch (Exception exception2) {
}
encode = "GBK";
try {
if (strequals(new String(strgetBytes(encode), encode))) { //判断是不是GBK
String s3 = encode;
return s3;
}
} catch (Exception exception3) {
}
return ""; //如果都不是,说明输入的内容不属于常见的编码格式。一、查看MySQL数据库服务器和数据库MySQL字符集。
命令:
1
mysql> show variables like '%char%';
二、查看MySQL数据表(table)的MySQL字符集。
命令:
1
mysql> show table status from sqlstudy_db like '%countries%';
三、查看MySQL数据列(column)的MySQL字符集。
命令:
1
mysql> show full columns from countries;
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)