网页页面编码utf8
String distype=request.getParameter("distype");
distype=myb.isotoutf8(distype);//转换字符编码的函数代码如下
/*转换*/
public String isotoutf8(String str)
{
String s=str;
try
{
s=new String(s.getBytes("ISO-8859-1"),"utf-8");
return s;
}
catch(Exception e)
{
return null;
}
}
当传递如下参数时http://localhost:8080/goushuang/luntan.jsp?distype=店铺动态 时结果显示:店铺动口
而传递如下参数时http://localhost:8080/goushuang/luntan.jsp?distype=店铺公告 时结果显示:店铺公告
有谁知道这是怎么回事?
String distype=request.getParameter("distype");
distype=myb.isotoutf8(distype);//转换字符编码的函数代码如下
/*转换*/
public String isotoutf8(String str)
{
String s=str;
try
{
s=new String(s.getBytes("ISO-8859-1"),"utf-8");
return s;
}
catch(Exception e)
{
return null;
}
}
当传递如下参数时http://localhost:8080/goushuang/luntan.jsp?distype=店铺动态 时结果显示:店铺动口
而传递如下参数时http://localhost:8080/goushuang/luntan.jsp?distype=店铺公告 时结果显示:店铺公告
有谁知道这是怎么回事?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货