8859_1这是什么,应该是ISO-8859-1

解决方案 »

  1.   

    你是否想把这个byte数组保存的字节转化成汉字?
    如果这样,按如下试试;
    String str1=new String(bytes);
    String nstr=new String(str1.getBytes("ISO-8859-1"),"GB2312");
      

  2.   

    String str=new String(bytes);
    String str1=new String(str.getBytes("ISO-8859-1","GB2312"));
      

  3.   

    试试:
    String str=new String(bytes);
    String str1=new String(str.getBytes("ISO-8859-1"));
      

  4.   

    汉字始终是??????程序代码如下:
      ServletInputStream inPut = request.getInputStream();  String realpath = application.getRealPath("/bin/report/");
      java.io.File file_out=new java.io.File(realpath+"reportstencil.xml");
      FileOutputStream fos=new FileOutputStream(file_out);  int c = 0;
      byte[] bytes=new byte[1024];
      while((c=inPut.read(bytes))!=-1){
       String nstr = new String(bytes);
       String nstr2 = new String(nstr.getBytes("iso-8859-1"),"gb2312");
       System.out.println(nstr2);
       fos.write(bytes,0,c);
      }
      fos.close();
      inPut.close();调用方法:
       var oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
       oXmlHttp.Open("POST","../util/saveXmlToServer.jsp",false);
       oXmlHttp.setRequestHeader("Content-Type","text/xml");
       oXmlHttp.setRequestHeader("charset","utf-8");
       var xmlDoc = "<xml id=\"mData\">\n"+
                    xmlData+"</xml>"
       oXmlHttp.Send(xmlDoc);
       if(oXmlHttp.status==200){
        var rText = oXmlHttp.responseText;
         if(rText.substring(0,1)=="0"){
          return 0;
         }else{
          return 1;
         }
       }else{
        return 2;
       }
      

  5.   

    请问你在jsp页面charset="gb2312"有了吗,没的话你再怎么.getbyts("iso-8859-1"),"gb2312");也没用。
      

  6.   

    这方面的东东太多了 search吧
      

  7.   

    页面已经有了
    <%@page contentType="text/html;charset=gb2312"%>
      

  8.   

    如果这样不行的话,先调用:
    System.setProperty("file.encoding","GB2312");
    再执行字符串的转换!
      

  9.   

    System.setProperty("file.encoding","GB2312");
    加了还是不得行,好怪?
      

  10.   

    插入数据库时乱码的解决方法:
    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)
    {
    }
    return "null";
    }
      

  11.   

    web方式编码用ISO8859_1就够了
    但是我的application就不行了晕
      

  12.   

    抗议sun,给鬼子做日语版本,不管我们中国大爷私活!