大家好,,
我在jsp页面上提取的 数据库字段有几个字是乱码,不知道是怎么回事,这些字在sql server里都没问题,就是在jsp 页面显示的时候是个 问号( 比如 李溦 显示为李?其他字都能正常显示)希望大家能给点意见.先多谢了!!!!!
我在jsp页面上提取的 数据库字段有几个字是乱码,不知道是怎么回事,这些字在sql server里都没问题,就是在jsp 页面显示的时候是个 问号( 比如 李溦 显示为李?其他字都能正常显示)希望大家能给点意见.先多谢了!!!!!
解决方案 »
- jsp网站部署到linux机器上,网站上的上传文件功能可以用吗?
- @Context HttpServletRequest request,@Context HttpServletResponse response
- jsp样式问题
- java--如何在一个类中修改另一个类中变量值?
- 为啥我这个博客日志的修改功能不能实现呀?
- 求教多人如何操作application?
- 新手请教:怎样在winXP下配置jsp,小弟十分着急
- 怎样调试BEAN的客户段,需要什么参数吗
- jbuilder8中的关于struts的奇怪错误.
- 求救:向oracle中一个BLOB字段插入一个图片的方法,出错信息如下,源码如下,高分给第一个告知原因的人
- validwhen验证,我这样下,怎么不管用?
- 在线:讨论:什么是 web中间件?
<%@ page import="java.io.*"%>
<%! String trans(String chi)
{
String result = "";
byte temp [];
try
{
temp=chi.getBytes("gb2312");
result = new String(temp);
}
catch(UnsupportedEncodingException e)
{
System.out.println (e.toString());
}
return result;
}
%>但还是不成,,,急死我了..
//从库中读出iso8859_1--->gb2312
public static String UnicodeToChinese(String s){
try{
if(s==null||s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
//写入库 gb2312--->iso8859_1
public static String ChineseToUnicode(String s){
try{
if(s==null||s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("gb2312"),"ISO8859_1");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}要多测试几次, 总觉得没有一劳永逸地方法 :(