关于汉字转换问题
我的一个,一但进行汉字转换,程序就出错,请问是什么原因?谢谢
Example3.jsp
<%@ page contentType="text/html;charset=GB2312"%>
<html>
<body bgcolor=cyan> <font size=2>
<form action="tree.jsp" method=post name=form>
<input type="text" name="boy">
<input type="submit" value="提交" name="submit">
</form>
</body>
</html>
tree.jsp
<%@ page contentType="text/html;charset=GB2312"%>
<html>
<body>
<p>获取文本的信息:
<%
String set=request.getParameter("boy");
byte b[]=set.getBytes("ISO-8859-1");
String set=new String(b);
%>
<br>
<%=set%>
</body>
</html>
问题点数:20、回复次数:4Top
1 楼miaoliujun(傲龙)回复于 2003-12-03 18:22:42 得分 5
你要转换到iso8859-1的byte干什么?
一个程序中可以定义两个同名的string?(set)Top
2 楼zhang21cnboy(事了抚衣去,不留身与名)回复于 2003-12-03 18:32:49 得分 5
String set=new String(b);
这个修改乘:
String set=new String(b,“gb2312”);Top
3 楼maweihua(laoma)回复于 2003-12-03 18:47:21 得分 5
String set 是不是声明了两次?Top
4 楼louis716()回复于 2003-12-03 18:54:53 得分 5
<%
String set=request.getParameter("boy");
byte b[]=set.getBytes("ISO-8859-1");
String set=new String(b);
%>
改成这个:
<%
String set=request.getParameter("boy");
byte b[]=set.getBytes("ISO-8859-1");
set=new String(b);
%>
Top




