<a herf="<%=java.net.URLEncoder.encode("http://localhost:8080/test/说明.doc")%>">说明</a>

解决方案 »

  1.   

    试试:
    str = new String(str.getBytes("GB2312"),"8859_1");
    str = new String(str.getBytes("8859_1"),"GB2312");
      

  2.   

    我试了wujinpinga(滴水穿石) ,tx18(华哥) 的方法都不行牙.还有没有别的方法?
      

  3.   

    地址栏中的乱码不引响你取文件的中文值的,可以不用去管它。如果在它的下一个页面要接收这个中文值,那么用如下方法进行转码
    str = new String(str.getBytes("8859_1"),"GB2312");
      

  4.   

    String firstText = java.net.URLEncoder.encode(firstText_temp);
           response.sendRedirect(url+page+".jsp?firstText="+firstText+"&secText="+secText);然后new String( request.getParameter( "firstText" ).getBytes( "8859_1") , "GB2312" )
      

  5.   

    通过浏览器直接打开这个中文名字的文档,而不是链接到另一个jsp文件,出现乱码的话,就会找不到这个文件,出现这样的页面提示:
    The requested resource (/test/鏂伴〉鏇存柊璇存槑.doc) is not available.
      

  6.   

    用java.net.URLEncoder.encode()
    例:中文传值
        <a href=response.jsp?id=<%=java.net.URLEncoder.encode("中文字符")%>>.....</a>
       
      

  7.   

    如果是传值给另一个jsp,按照上面的方法应该可以的,但我现在的问题是链接到一个文档,比如在jsp里,上传附件时,附件的名字是中文的,打开这个中文的附件.比如http://localhost:8080/test/说明.doc
      

  8.   

    这种方法,保证有效
    <% request.setCharacterEncoding("gb2312"); %>
    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
      

  9.   

    还是不行呀,我用的是jboss服务器
      

  10.   

    找你的配置文件:URIEncoding="utf-8"是uri,不是url,肯定ok
      

  11.   

    修改以下设置试一下:
    IE / 工具 / Internet选项... / 高级, 去掉“始终以UTF-8发送URL”的选项。
    这样也许行。
      

  12.   

    "始终以UTF-8发送URL"勾选上
    form用POST而不能用GET
    另外这个值到底是用户输入还是数据库读出来的?
      

  13.   

    new021()的方法:
    修改以下设置试一下:
    IE / 工具 / Internet选项... / 高级, 去掉“始终以UTF-8发送URL”的选项。
    可以,但是能否通过程序或者配置文件的修改来实现,因为我们做的产品,总不能每次都让客户去手动改配置.
      

  14.   

    回复人: ztchi(马也) ( ) 信誉:97  2004-4-5 16:53:05  得分:0 
     
     
      
    用java.net.URLEncoder.encode()
    例:中文传值
        <a href=response.jsp?id=<%=java.net.URLEncoder.encode("中文字符")%>>.....</a>
    这个方法是对的!
    有问题再找我!
    MSN :[email protected]  
     
      

  15.   

    <a href="http://localhost:8080/test/read.jsp?FileName=说明.doc">xxx</a>
    ..................
    -----------------------read.jsp---------------------
    .............String str = request.getParameters("FileName");
    str = new String(str.getBytes("GB2312"),"8859_1");response.sendRedict("http://localhost:8080/test/" + str);
    ...............
    -----------------------------------------------------
      

  16.   

    str = new String(str.getBytes("8859_1"),"utf-8");
    把它转成utf_8试试