<html>
<%@ page contentType="text/html; charset=GB2312" %>
<%
              
String tt="你是";
try
{
tt=tt.toString();
}
catch(Exception e){}
%>
<%=tt%>
</html>

解决方案 »

  1.   

    头文件应是这样的
    <%@ page contentType="text/html; charset=GBK" %>
      

  2.   

    可我这里就是不行呀,结果显示的是“`/”,是不是IE或jswdk还要进行其它配置呀
      

  3.   

    以前我有时候用temp=tt.getBytes("ISO-8859-1");好使
    有时候又改为temp=tt.getBytes("gb2312");好使
      

  4.   

    <html>
    <%@ page contentType="text/html; charset=GB2312" %>
    <%
                  
    String tt="你是";
    try
    {
    byte[] temp;//
    temp=tt.getBytes("ISO-8859-1");
    tt=new String(temp,"GB2312");
    }
    catch(Exception e){}
    %>
    <%=tt%>
    </html>
      

  5.   

    你定义一个METHOD
    加个方法:
    <%!public getStr(String str) throws Exception
      {   try{ 
        String temp=str;
        byte[] temp_p=temp.getBytes("ISO-8859-1");
        return new String(temp_p,"GBK");;
       }catch(Exception e)
       {
       }
    %>
      

  6.   

    网上有很多专门转换的bean,你上网搂一下就行了,如果一定要用以上的方法,值得注意的是getBytes()有种形式是带参数的,如楼上的getBytes("ISO-8859-1")