response.setContentType("text/html","charset=CBK");

解决方案 »

  1.   

    response.setContentType("text/html","charset=CBK");
    或者response.setContentType("text/html","charset=Big5");
      

  2.   

    string req=Request.getParam("");//得到参数
    string final = new String( req.toByteArray("iso-8859-1"),"Big5");
    response.write(final);
    我用dotnet时间太长了,函数有些记不清了,麻烦楼主调通,这招对GBK绝对有效,相信对Big5也管用
      

  3.   

    我的中文字符不是通过request.getParameter取得的。
    是写死在servlet中的。
    代码的开始有写:
    out.print("<html>");
    out.print("<head><title></title>");    
    out.print("<meta http-equiv='Content-Type' content='text/html; charset=BIG5'>");
    String msg=“代码错误”;
    out.print(msg);
    。。
    但这样子就是乱码
      

  4.   

    string req=Request.getParam("");//得到参数
    string final = new String( req.toBytes("iso-8859-1"),"Big5");
    response.write(final);
      

  5.   

    用个编码转换工具,把你写得jsp文件,换成gb->big5即可,可以用iconv
      

  6.   

    已经解决谢谢各位的关心。。
    不过我编译的时候用javac Sample.java -encoding big5