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("ISO-8859-1"), "GB2312");
System.out.println(str);
return str;
}
catch (Exception ex){
System.out.println(ex.toString());
return "";
}
}
}
if (strSource == null){
return "";
}
else{
try{
//return new String(strSource.getBytes("GB2312"), "ISO-8859-1");
String str = new String(strSource.getBytes("ISO-8859-1"), "GB2312");
System.out.println(str);
return str;
}
catch (Exception ex){
System.out.println(ex.toString());
return "";
}
}
}
解决方案 »
- 求一个正则表达式
- struts2 action返回处理消息到页面
- JSP 可以发布成单机版吗?
- spring配置 jboss 的jndi数据源出错
- 我遇到的Java程序员上机题,请大家一起讨论
- 就咱们论坛中,左侧的树形结构是怎么做出来的呀?高手指点一下,虚心学习!
- httpclient 上传文件和其他参数,使用MultipartRequest类接收文件和字段时,文件打不开,多2字节。
- bean中提取数据库内容不起作用
- 感谢tangbow给的答案,特此给分20,不好意思....分不多.....
- 初學者之吻
- 很菜的问题,关于mysql的
- 请问在jsp中使用applet,web-inf要如何配置吗?
iso-8859-1这个地方可以多试几个参数
utf-8,GBK,gb2312
应该把getObject改成getString就可以了,这两个有什么区别马?