关于java的乱码问题,到处都是,找个文章看看吧。

解决方案 »

  1.   

    <%! //处理中文问题的自定义函数
    public String getStr(String str)
    {
    try
    {
    String temp_p=str;
    byte[] temp_t=temp_p.getBytes("ISO8859-1");
    String temp=new String(temp_t);
    return temp;
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    return "null";
    }
    %>        
    <%!//处理中文问题的自定义函数
    public String getStr2(String str)
    {
    try
    {
    String temp_p=str;
    byte[] temp_t=temp_p.getBytes("GBK");
    String temp=new String(temp_t,"ISO8859_1");
    return temp;
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    return "null";
    }
    %>  
    这是别人写的函数,试试吧.
      

  2.   

    <%! //处理中文问题的自定义函数
    public String getStr(String str)
    {
    try
    {
    String temp_p=str;
    byte[] temp_t=temp_p.getBytes("ISO8859-1");
    String temp=new String(temp_t);
    return temp;
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    return "null";
    }
    %>        
    <%!//处理中文问题的自定义函数
    public String getStr2(String str)
    {
    try
    {
    String temp_p=str;
    byte[] temp_t=temp_p.getBytes("GBK");
    String temp=new String(temp_t,"ISO8859_1");
    return temp;
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
    return "null";
    }
    %>  
    这是别人写的函数,试试吧.