????????
就是这样,是jsp但只在读出数据的时候是这样,我觉得应该是数据库的问题!

解决方案 »

  1.   

    如果是JSP,你在程序里面加了这条语句吗?<%@page contentType="text/html;charset=gb2312"%>
      

  2.   

    因为我用jsp写别的中文没有问题,只是从数据库里来的中文数据有问题
    绝对是数据库的问题,
    字段类型该设成什么?
    varchar不行么?
      

  3.   

    varchar应该是对的阿!!
    有程序吗?我看看
      

  4.   

    ejb怎么看啊,我就是findByPrimaryKey只后,在get只要是中文的,就是一堆?????
      

  5.   


      public static String unicodeToGB(String strIn) throws Exception {
        String strOut = null;
        if(strIn == null || (strIn.trim()).equals(""))
          return strIn;
        byte[] b = strIn.getBytes("GBK");
        strOut = new String(b,"ISO8859_1");
        return strOut;
      }  public static String GBToUnicode(String strIn) throws Exception {
        String strOut = null;
        if(strIn == null || (strIn.trim()).equals(""))return strIn;
        byte[] b = strIn.getBytes("ISO8859_1");
        strOut = new String(b,"GBK");
        return strOut;
      }以上是两个常见的转换方法,出现问题时可以试试
      

  6.   

    这样编译:javac yourfile.java -encoding iso-8859-1
      

  7.   

    eternalee(看看) 
    我是用jbuilder如果要那样编译的话,要怎么做????
      

  8.   

    再jbuilder中的project properties中可以改变你的编码为iso8859-1;
    但读出数据时可能还会遇到问题。就需要:
    public static String unicodeToGB(String strIn) throws Exception {
        String strOut = null;
        if(strIn == null || (strIn.trim()).equals(""))
          return strIn;
        byte[] b = strIn.getBytes("GBK");
        strOut = new String(b,"ISO8859_1");
        return strOut;
      }
      

  9.   

    还没有解决么?
    试试这个:
    str=new String(str.getBytes("ISO-8859-1"),"gb2312");
      

  10.   

    前一阵子我也在为这问题迷惑呢。难道这有这样的
    写函数的解决办法么?
    难道不能直接设置从数据库出来的字符集就是GBK的了么?
    虽然它是按照unicode存储的(我的数据库是oracle)
    迷惑中......
      

  11.   

    存数据时用ISO存到数据库,
    在jsp中加上!
    <%@page contentType="text/html;charset=iso-8859-1"%>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    我今天刚搞定的!
      

  12.   

    我前阶段也碰到过类似问题
    解决的方法是把数据库中字段类型为varchar改为nvarchar即可
    你试试看
      

  13.   

    sikuan(葫芦) 问题真的解决了,就是你那方法,感激!!!
    在这里我想大家讨论原因,为什么这样改就可以了??
    在我不做设置和转换的情况下,写入和读出分别是什么格式?
    请sikuan(葫芦)稍等,讨论过后立即给分