例:解析后 <?xml version="1.0" encoding="gb2312"?? <root?<bb><cc>11</cc></bb></root>我试了utf-8,gb2312,gbk  这种情况还是不能解决

解决方案 »

  1.   

    一个简单的例子public static void main(String[] args) throws IOException {
    String res = "<?xml version=\"1.0\" encoding=\"gb2312\"?><root><bb><cc>11</cc></bb></root>";

    BASE64Encoder encoder = new BASE64Encoder();
    String target = encoder.encode(res.getBytes());

    BASE64Decoder decoder = new BASE64Decoder();
    byte[] buf = decoder.decodeBuffer(target);
    String str = new String(buf);
    System.out.println(str);
    }楼主如何实现的,上代码看看吧。