全部改用jdk1.5好了
下载:http://zdhsoft.adday.net/jdk1.5.exe

解决方案 »

  1.   

    <%@ page contentType="text/html; charset=GBK">
    <%@page import="java.util.*"%>
    <%@page import="java.lang.*"%>
    <%
        String B = Util.transCode(request.getParameter("Br"));
    .
    .
    .
    %>import java.util.* ;
    public class Util
    {
      public Util ()
      {
      }
      public  static String transCode (String input)
      {
        if (input == null)
        {
          return null ;
        }
        String result = input ;
        try
        {
          result = new String(input.getBytes("ISO-8859-1"), "GB2312") ;
        }
        catch (Exception ex)
        {
        }
        return result ;
      }
    }
      

  2.   

    <%@ page contentType="text/html; charset=GBK" import="com.web.*"%>
    <%@page import="java.util.*"%>
    <%@page import="java.lang.*"%>
    <%
        String B = Util.transCode(request.getParameter("Br"));
    .
    .
    .
    %>package com.web ;import java.util.* ;
    public class Util
    {
      public Util ()
      {
      }
      public  static String transCode (String input)
      {
        if (input == null)
        {
          return null ;
        }
        String result = input ;
        try
        {
          result = new String(input.getBytes("ISO-8859-1"), "GB2312") ;
        }
        catch (Exception ex)
        {
        }
        return result ;
      }
    }
    ;
      

  3.   

    从StringBuffer中得到的字符串 String str = new String(strBuffer);用一下编码转换就可以了;
    比如在jsp页面中加入
    <%@ page contentType="text/html; charset=GBK">
    <%
        String B = new String(str.getBytes("ISO-8859-1"),"GBK");
    .
    .
    %>
    这样得到的就应该是正确的汉字了。
      

  4.   

    <%@ page contentType="text/html; charset=GB2312" %>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    都加了,并且数据库存取都转化,才没有乱码。不知道为什么
      

  5.   

    用过滤类啊,网上一把现成的source哎
      

  6.   

    http://blog.csdn.net/treeroot/articles/129181.aspx
    http://blog.csdn.net/treeroot/articles/129185.aspx
    看明白这两篇中文问题就没有问题了
      

  7.   

    乱码是很正常的,你的jsp页面字符集是什么,utf-8就很容易乱码的,
    1.最简单就是在编辑的时候就设置一下字符集,
    2.从资源文件读取,中文都转成unicode
    3.如果经过数据存取/url传送等 就要先知道原先的字符集:
      String s2 = new String(s1.getBytes(),'指定你要转换成的字符集');
      

  8.   

    参考了 treeroot(根根) 给的两篇文章,如下可解决了应该:<%@page pageEncoding="GB2312"%>//为了让JSP编译器能正确地解码我们的含有中文字符的JSP文件,我们需要在JSP源文件中指定我们的JSP源文件的编码格式
    <%@page contentType="text/html; charset=gb2312"%>//保证JSP向客户端输出时是采用中文编码方式输出的
    <%request.setCharacterEncoding("GB2312");%>//为了让JSP能正确获得传入的参数
      

  9.   

    <%! String trans(String chi)
    {
                   String result = null;
                   byte temp [];
                   try
                   {
                           temp=chi.getBytes("gb2312");
                          result = new String(temp);
                    }
                    catch(UnsupportedEncodingException e)
                    {
                            System.out.println (e.toString());
                    }
    return result;
    }
    %>