1.接收响应流的<?xml version="1.0" encoding="gb2312"?> ...之前不应该有任何其他字符存在!包括" "
不然会报异常:
[Fatal Error] :1:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
2.把字符串的编码转换为utf-8
str=new String(str.getBytes("ISO8859_1"), "UTF-8");
不然会报异常:
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
不然会报异常:
[Fatal Error] :1:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
2.把字符串的编码转换为utf-8
str=new String(str.getBytes("ISO8859_1"), "UTF-8");
不然会报异常:
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.