统一编码
UNIX的oracle要写入之前转码

解决方案 »

  1.   

    试一试下面这段代码
    public String iso2gb(String qs) 

    try{ 
    if (qs == null) return "NULL"; 
    else 

    return new String(qs.getBytes("iso-8859-1"),"gb2312"); 


    catch(Exception e){ 
    System.err.println("iso2gb error:"+e.getMessage()); 

    return "NULL"; 
    } public String gb2iso(String qs) 

    try 

    if (qs == null) return "NULL"; 
    else { 
    return new String(qs.getBytes("gb2312"),"iso-8859-1"); } 

    catch(Exception e){ System.err.println("gb2iso error:"+e.getMessage());} 
    return "NULL"; 
    } 字符存入数据库时用 gb2iso()函数,将字符从数据库取出时,再用 iso2gb()函数。 另,jsp页面的顶部应该加入下面句话: 
    “<%@page contentType="text/html;charset=gb2312"%> ”
      

  2.   

    public class CodeConvert {
    private String re;
    public void convert(String externS){
        this.re = externS;
        
        if(this.re!=null)
        {
          try{
            this.re = new String(re.getBytes("8859_1"), "GB2312");
          }
          catch(Exception e)
          {
            System.out.println("编码转换异常!");
          }
         }
    }
    public String getConvert(){
    return this.re;
    }
    }
      

  3.   

    我以前出现问题的时候也是用“fokman(傲视红尘)”这种方法解决的。
    数据读入数据库转一遍,读出的时候在转一遍
      

  4.   

    同意楼上pioneerzhou(害怕距离) 的,最好在jsp页面中再加一句:<%request.setCharacterEncoding("GBK");%>,这样就准没问题
      

  5.   

    http://www.regexlab.com/zh/encoding.htm
    看看这个有帮助
      

  6.   

    String str = new String(rs.getString("").getBytes(),"GB2312");