CHARSET=UTF-8:=E7=88=B8=E7=88=B8;好像怎么转换都没办法转换成中文

解决方案 »

  1.   


    public static void main(String args[])throws Exception{        
    String str = "=E7=88=B8=E7=88=B8";
    str = str.replace("=", "");
    int j=0;
    byte[] buff = new byte[str.length()/2];
    for(int i=0;i<str.length();i+=2){
    String tmp = str.substring(i,i+2);
    int ch = Integer.parseInt(tmp,16);
    buff[j++] = (byte)(ch | 0xffffff00 );
    }
    str = new String(buff,"UTF-8");
            System.out.println(str);//爸爸
    }
      

  2.   

    顶一下.没懂这一句
    buff[j++] = (byte)(ch | 0xffffff00 );//这个或运算有什么作用的?低8位是0,相当于没有做运算诶……
      

  3.   

    UTF8编码规则看一下.
    是一种变长编码,其实还原UTF8也不太容易呢,需要理解底层原理.