jsp中最好写<%@ page language="java" contentType="text/html; charset=gb2312"%>,这个指定了你的页面显示的charset,不然,即使你在html里面指定也是没有用的

解决方案 »

  1.   

    哎,关键是涉及到一些特殊字符,gb2312显示不了的,所以想用tomcat默认的,iso8859_1,这样页面显示就成了问题。
      

  2.   

    在你页面的首行加入<%@ page language="java" contentType="text/html; charset=gb2312"%>
      

  3.   

    或者这个?<%@ page language="java" contentType="text/html; charset=GBK"%>
      

  4.   

    可以试试下面的://从HTTP请求的头信息中获取客户端的语言设置
    String clientLanguage = request.getHeader("Accept-Language");                
    //简体中文浏览器             
    if ( clientLanguage.equals("zh-cn") ) {                        
        request.setCharacterEncoding("GBK");           
        response.setContentType("text/html; charset=GBK");        
    }        
    //繁体中文浏览器        
    else if ( clientLanguage.equals("zh-tw") ) {            
        request.setCharacterEncoding("BIG5");            
        response.setContentType("text/html; charset=BIG5");        
    }        
    //日文浏览器        
    else if ( clientLanguage.equals("jp") ) {            
        request.setCharacterEncoding("SJIS");            
        response.setContentType("text/html; charset=SJIS");        
    }        
    //缺省认为是英文浏览器        
    else {            
        request.setCharacterEncoding("ISO-8859-1");            
        response.setContentType("text/html; charset=ISO-8859-1");        
    }        ...        
    //设置好request的解码方式和response的编码方式后,进行后续的操作。
      

  5.   

    线索提供,用多语言支持配置文件好了,写xml,
    哈哈,我没用过
      

  6.   

    奇怪,我servlet中request.setCharacterEncoding("GBK"); 
    在jsp中?<%@ page language="java" contentType="text/html; charset=GBK"%>
    结果数据提交后居然是乱码。
    我跟踪了一下,在servlet中经过gbk转换后就变成乱码了,这是怎么回事?
      

  7.   

    除了在头文件中写
    <%@ page language="java" contentType="text/html; charset=gb2312"%>
    得到变量还要这样写:肯定不会有乱码问题:title = new String(request.getParameter("title").getBytes("ISO8859-1"),"GB2312");
      

  8.   

    我用resin不写那句,ie会显示jsp的原代码。
    -------------------------
    我流落在凄凉的世界里-孤苦伶仃
    我过着动荡无助的生活-四处漂泊
      

  9.   

    GBK也不见得好用,或者经过的工序不一样也不一定嘛。