String Cust_Sex=request.getParameter("cust_sex");//这时softname里存的是按iso8859-1理解的字符
byte[] buf2=Cust_Sex.getBytes("ISO-8859-1");//还原成浏览器发来的字节数据(按iso8859解码前的数据)
Cust_Sex = new String(buf2,"gb2312");//按gb2312重新解码

解决方案 »

  1.   

    public  class TranslateString
    {
    public static String translateORACLEToJSP(String str)
    {
    String tempStr="";
    try
    {
    tempStr=new String(str.getBytes("gb2312"),"ISO-8859-1");

    }
    catch(Exception e)
    {
    System.err.println(e.getMessage());
    }
    return tempStr;
    }


    public static String translateJSPToORACLE(String str)
    {
    String tempStr="";
    try
    {
    tempStr=new String(str.getBytes("ISO-8859-1"),"gb2312");

    }
    catch(Exception e)
    {
    System.err.println(e.getMessage());
    }
    return tempStr;
    }

    }