int 如何能转变成为汉字的?char只是英文字符.

解决方案 »

  1.   

    byte []b=new byte[Buffer];
    input.read(b,Buffer);
    String str=new String(b,"GBK");
    System.out.println(str);
      

  2.   

    注意:汉字是用双字节编码(是acsII码的两倍)
    建议你用下面代码读取数据,看看     int len = hpCon.getContentLength();
         InputStream input = hpCon.getInputStream();
          byte[] raw = new byte[len];
          int length = input.read(raw);      input.close();
          
          String s = new String(raw, 0, length); 
         System.out.println(s);