在jsp页面中使用response.sendRedirect()时,如果我的浏览器的encoding选中Auto-Select则可能出现乱码,因为浏览器好像是随便选择了一个代码做为page的代码,而不是根据我在meta-tag中设置的编码处理,如果我不选中Auto-Select好像就不会出现这个问题。我的服务器是win 2000 advanced server, web server 是weblogic 6.1,请问问题出在哪里?谢谢。

解决方案 »

  1.   

    楼主:
    你在页面制定显示的编码
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    或者 page contentType="text/html; charset=utf-8"
      

  2.   

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    或者 page contentType="text/html; charset=utf-8"
    用utf-8可以吗?我用resin就不行。可能是不支持。我现在手头上没有weblogic,回去后测试一下。
      

  3.   

    我用的是
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">,没有用UTF。在不是重定向的页面没有问题。yxhzj(余华[学习J2EE中])所说的“强制定义页面编码”也是指这个吗?
      

  4.   

    <%@ page contentType="text/html; charset=gb2312"%>
    放在页面第一行
      

  5.   

    放在首行
    <%@ page contentType="text/html;charset=GBK"%>
      

  6.   

    <%@ page contentType="text/html;charset=GBK"%>
    讲这句话放在jsp页面的首行中