sort = new String(sort.getBytes("ISO-8859-1"),"GB2312");
title= new String(title.getBytes("ISO-8859-1"),"GB2312");db.param[0]=sort;
db.param[1]=title;
title= new String(title.getBytes("ISO-8859-1"),"GB2312");db.param[0]=sort;
db.param[1]=title;
请问一下 skyyoung(路人甲) :
你的这二句话:
sort = new String(sort.getBytes("ISO-8859-1"),"GB2312");
title= new String(title.getBytes("ISO-8859-1"),"GB2312");
达到什么功能啊?能讲一下它的原理吗?
加了二句出现如下提示:
An error occured between lines: 5 and 51 in the jsp file: /test.jspGenerated servlet error:
E:\Apache Tomcat 4.0\work\localhost\_\test$jsp.java:103: Invalid character in input.
????????????????String title= new String(title.getBytes("ISO-8859-1"),"????");
^
An error occured between lines: 5 and 51 in the jsp file: /test.jspGenerated servlet error:
E:\Apache Tomcat 4.0\work\localhost\_\test$jsp.java:103: Invalid character in input.
????????????????String title= new String(title.getBytes("ISO-8859-1"),"????");
拼一个8859编码的字符串,因为数据库默认为8859,如果中文不进行处理的化,是不能得到正确的查询结果的。
那么
String(sort.getBytes("ISO-8859-1"),"GB2312")
用它来进行把sort字段转化成汉字,可是这里我的目的是要把外面的 sort变量与数据库里的字段sort进行比较,这里也要把sort变量转化成汉字吗?他本身不是汉字吗?
不解?
<jsp:useBean id="db" scope="session" class="result_db.result_db" />