import java.io.*;/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/public class EnglishToChinese { public String ToChinese(String str){
String st="";
try {
st = new String(str.getBytes("ISO-8859-1"), "GBK");
}
catch (UnsupportedEncodingException ex) {
}
return st;
}
}这样就可以了
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/public class EnglishToChinese { public String ToChinese(String str){
String st="";
try {
st = new String(str.getBytes("ISO-8859-1"), "GBK");
}
catch (UnsupportedEncodingException ex) {
}
return st;
}
}这样就可以了
我想我的问题不在这里:我用des加密时是按每个字符8位算的。而一个汉字是16位。
问题出在算法里面。请问des对中文是怎么加密的?