可以实施,现转换成iso-8859-1,然后在转换成GBK,
不过一般不会出现你这样的问题,要不写一个比较严谨的方式
public static String charConvert(String strSource){
if (strSource == null){
return "";
}
else{
try{
//return new String(strSource.getBytes("GB2312"), "ISO-8859-1");
String str = new String(strSource.getBytes("utf-8"), "GBK");
System.out.println(str);
return str;
}
catch (Exception ex){
System.out.println(ex.toString());
return "";
}
}
}
不过一般不会出现你这样的问题,要不写一个比较严谨的方式
public static String charConvert(String strSource){
if (strSource == null){
return "";
}
else{
try{
//return new String(strSource.getBytes("GB2312"), "ISO-8859-1");
String str = new String(strSource.getBytes("utf-8"), "GBK");
System.out.println(str);
return str;
}
catch (Exception ex){
System.out.println(ex.toString());
return "";
}
}
}
解决方案 »
- 根据数据库取出字段值 让JSP复选框默认选中的问题(三叩首了先,谢谢)
- Ext 表单提交问题 大家快来看看
- tomcat6下的路径问题
- hibernateTemplate多表外键存储
- hibernate+spring 编写的CRUD制作
- ORACLE菜鸟一个,请各位前辈多多指导 那里有ORACLE的入门教程下载?请给个具体入门教程的网址. 有分回报谢谢!
- 如何学习使用JSP进行WEB开发
- 问一个数据多用户操作得问题!!
- jspsmartupload能不能上传文件到sql server数据库里面啊?很急
- tomcat4.1.12中的Administration怎么进入?在线等待!!
- 有关两个ResultSet的问题,不难的,帮帮忙吧!小女子在此谢过各位!
- 安装界面的实现
String s = dis.readUTF();
new ByteArrayInputStream(tempString.getBytes("utf-8")));
String temp11 = DataInputStream.readUTF(tempIN);
抛出java.io.EOFException,何解