public static String UnicodeToChinese(String s){
try{
String newstring=null;
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}public static String ChineseToUnicode(String s){
try{
String newstring=null;
newstring=new String(s.getBytes("gb2312"),"ISO8859_1");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
利用上面的函数,转换你的函数名为unicode。
就可以了,java对中文的支持不是很好,所你要在读到是中文的时候转换编码。就可以了,转成unicode,应该不会有问题了。
try{
String newstring=null;
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}public static String ChineseToUnicode(String s){
try{
String newstring=null;
newstring=new String(s.getBytes("gb2312"),"ISO8859_1");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
利用上面的函数,转换你的函数名为unicode。
就可以了,java对中文的支持不是很好,所你要在读到是中文的时候转换编码。就可以了,转成unicode,应该不会有问题了。
如果我用InputStreamReader构造这个ZipInputStream流,那我如何来取得各个entry???
ZipFile zipfile = new ZipFile(zipfile);
Enumeration enum = zipfile.entries();while(enum.hasMoreElements()) {
// 这里取得entry
entry = (ZipEntry) enum.nextElement(); //这里可以对文件名进行编码
String name = new String(entry.getName().getBytes("ISO8859_1"), file_encoding); //解压缩操作
}
//解压缩操作
具体如何?
file_encoding??这又是什么?
拜托贴出全部代码