URL中的%...怎么转换成中文...
谢谢!!!
String gbk=URLDecoder.decode("%E6%8E%A5%E5%8F%97%E7%9A%84%E6%96%87%E4%BB%B6.txt","UTF");
转换成的不对...
谢谢!!!
谢谢!!!
String gbk=URLDecoder.decode("%E6%8E%A5%E5%8F%97%E7%9A%84%E6%96%87%E4%BB%B6.txt","UTF");
转换成的不对...
谢谢!!!
if (str != null) {
byte[] tmpbyte = null;
try {
tmpbyte = str.getBytes("GBK");
}
catch (Exception e) {
System.out.println("Error: Method: dbconn.gb2iso :" + e.getMessage());
}
try {
str = new String(tmpbyte, "ISO8859_1");
}
catch (Exception e) {
System.out.println("Error: Method: dbconn.gb2iso :" + e.getMessage());
}
}
else
str = "";
return str;
}
public static String iso2gb(String str) {
if (str != null) {
byte[] tmpbyte = null;
try {
tmpbyte = str.getBytes("ISO8859_1");
}
catch (Exception e) {
System.out.println("Error: Method: dbconn.iso2gb :" + e.getMessage());
}
try {
str = new String(tmpbyte, "GBK");
}
catch (Exception e) {
System.out.println("Error: Method: dbconn.gb2iso :" + e.getMessage());
}
}
else
str = "";
if (str == null)
str = "";
return str;
}