关于字符转换!
我用的Access,吧网页上面的一段汉字存到数据库中,结果打开数据库却发现我村的东西全都变成了问号????,然后我又把数据库里面的东西返回显示到网页里面,结果全都是问号,我里面用了字符转化了,怎么会这样?转换bean如下
public String gbToiso(String str)
{
String newstr=null;
try{
byte[] exchange;
exchange = str.getBytes("ISO8859_1");
newstr= new String(exchange);
}catch(Exception e1){System.out.print(e1.toString());}
return newstr;
}
public String isoTogb(String str)
{
String newstr=null;
try
{
byte[] exchange;
exchange=str.getBytes("ISO8859_1");
newstr=new String(exchange,"GB2312");
}catch(Exception e2){System.out.print(e2.toString());}
return newstr;
}
怎么回事儿?哪里出错了?