<HTML><HEAD><TITLE>宁波公交线路查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*,java.util.*,com.line.*" errorPage="" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<% request.setCharacterEncoding("UTF-8");%>
<jsp:useBean id="lineFun"  scope="page" class="com.line.LineFun"></jsp:useBean>
<%String line_name="";
String stop_name="";
List lines=null;
//out.print(new String(request.getParameter("stop_name")).length());
if(request.getParameter("stop_name")!=null&&request.getParameter("stop_name")!=""){
stop_name=request.getParameter("stop_name").toString().trim();
stop_name=new String(stop_name.getBytes("8859_1"),"utf-8");
out.print(stop_name);
}
%>

解决方案 »

  1.   

    http://localhost:8080/gjcx/serve_1.jsp?stop_name=西草马路
    上面一个获取的结果是:西草马路
    http://localhost:8080/gjcx/serve_1.jsp?stop_name=西草马
    上面一个获取的结果是:西草&#65533; 
      

  2.   

    还有没有其它的法子呢,我整个系统都是用utf-8的
      

  3.   

    while (rs.next()) {
    String temp=rs.getString("Station");  
    try{
    temp=URLEncoder.encode(temp,"UTF-8");
    }
        catch(UnsupportedEncodingException e)
                    {                }
    lineinfo += "<a href=\"serve_1.jsp?stop_name="+temp+"\">"+rs.getString("Station")+"</a>、";
    }
      

  4.   

    你要先将“西草马路”进行UTF-8编码的
      

  5.   

    同意netthisway,我的分页就这么写的~~~~~~~~~~`
      

  6.   

    把这句
    <META http-equiv=Content-Type content="text/html; charset=utf-8">
    该为
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
      

  7.   

    &#65533; 为unicode编码,不是乱码