package java6;
import java.io.*;
public class codechange {
public static String GBtoBig(String s){
  try{
  String newstring=null;
  newstring=new String(s.getBytes("GB2312"),"Big5");
   return newstring;
  }
  catch(UnsupportedEncodingException e)
  {
  return s;
 }
  }
  public static String BigToGb(String s){
  try{
     String newstring=null;
     newstring=new String(s.getBytes("Big5"),"Gb2312");
     return newstring;
    }
  catch(UnsupportedEncodingException e)
  {
  return s;
  }
  }
}

解决方案 »

  1.   

    还是不行啊!
    这是我写的试验用的jsp页,显示的出来的是“?斜”!!!<%@ page contentType="text/html; charset=BIG5" language="java"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=BIG5">
    </head>
    <body>
    <jsp:useBean id="gb2big5" scope="page" class="hyclass.gb2big5"/>
    <%
    String bb=gb2big5.GBtoBig("中国");
    out.println(bb);
    %>
    </body>
    </html>
      

  2.   

    这样应该可以的啊
    你在ie里浏览的时候把编码改成big5再看看。
      

  3.   

    这样应该可以的啊
    你在ie里浏览的时候把编码改成big5再看看。