源文件是正常的。但是服务开启后,访问却是乱码。这是什么情况导致的》?

解决方案 »

  1.   

    源文件的物理编码 
    和 
    <?xml encoding="xxx" 
    和 
    JSP页面中的pageEncoding要一致。JSP页面中的contentType

    <meta http-equiv="Content-Type" content="text/html; charset=xxx" />
    要一致。以上最好全部一致。
      

  2.   

    jsp中<%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>在Servlet中request.setCharacterEncoding("utf-8");
    response.setContentType("text/html;charset=utf-8");然后数据库的编码也要一致,这样才能没乱码
      

  3.   

    内存中 字符集  unicode(utf-16)
    windows 中文操作系统  字符集 GBK
    form 表单      ISO-8859-1