0
A
回答
1
嗨Nithi确保 “远程-config.xml中” 目标id和源名称是正确的。
1
问题中没有足够的细节。
我的猜测, 看起来像你试图读取UTF-8编码的东西,它不是有效的UTF-8编码。
2
您的XML文档具有BOM标记,因为它是使用Windows程序创建的。
Java不支持开箱即用。
关于BOM: http://www.unicode.org/faq/utf_bom.html
因此,要么请确保您的XML文档没有BOM标记,(如果它是你的DS配置文件),或 使用这样的事情在你的InputStream:
(不是我的代码) http://koti.mbnet.fi/akini/java/unicodereader/UnicodeInputStream.java.txt
Usage pattern:
String enc = "ISO-8859-1"; // or NULL to use systemdefault
FileInputStream fis = new FileInputStream(file);
UnicodeInputStream uin = new UnicodeInputStream(fis, enc);
enc = uin.getEncoding(); // check and skip possible BOM bytes
InputStreamReader in;
if (enc == null) in = new InputStreamReader(uin);
else in = new InputStreamReader(uin, enc);
0
ByteArrayInputStream test = new ByteArrayInputStream(xml.trim().getBytes());
Document document = null;
try {
document = dbf.newDocumentBuilder().parse(test);
} catch (Exception e) {
System.out.println("Fehler 1" + e.getMessage()) ;
try {
test.close();
// ... that works: String xml_x = FkString.replace(xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");
// Replace UTF-8 to UTF8 ... works
String xml_x = FkString.replace(xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<?xml version=\"1.0\" encoding=\"UTF8\"?>");
test = new ByteArrayInputStream(xml_x.trim().getBytes());
document = dbf.newDocumentBuilder().parse(test);
} catch (Exception e1) {
System.out.println("Fehler 2" + e1.getMessage()) ;
}
}
相关问题
- 1. 无效字节1个字节的UTF-8序列错误
- 2. JAXB错误的说明:1字节UTF-8序列的字节1无效
- 3. getResponseBodyAsStream返回 “1字节UTF-8序列的无效字节1”
- 4. 1字节UTF-8序列的无效字节1
- 5. 引起:com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:1字节UTF-8序列的无效字节1
- 6. “无效字节1 1字节的UTF-8序列” 当读取RSS馈送
- 7. PostgreSQL的:“无效的字节序列编码‘UTF8’:只对错误
- 8. Grails - Jasper Plugin - 使用.jasper文件的1字节UTF-8序列错误的无效字节1
- 9. 验证模式无效字节1个字节的UTF-8序列
- 10. 导入的XMI文件的XML项目错误:无效字节1个字节的UTF-8序列
- 11. Postgres列加密错误 - 用于编码“UTF8”的无效字节序列:0xa3
- 12. Rails 3中,Heroku的 - PGError:错误:编码 “UTF8” 无效的字节序列:
- 13. 的PostgreSQL 9.5错误:编码“UTF8”无效的字节序列:0xc3 0xee
- 14. 错误:在pgadmin中插入用于编码“UTF8”的无效字节序列
- 15. Postgres插入错误 - 错误:编码“UTF8”的无效字节顺序:0x00
- 16. PicketLink:'错误:无效字节序列编码“UTF8”:设置密码时为0x00'
- 17. Postgresql PHP无效的字节序列编码UTF8
- 18. PostgreSQL - Psycopg2 - copy_from - 用于编码“UTF8”的无效字节序列:0x00
- 19. msgfmt波兰文字“无效多字节序列”错误
- 20. R-无效的多字节字符串1
- 21. MalformedByteSequenceException:2字节的UTF-8序列无效的字节2
- 22. 2字节UTF-8序列的无效字节2
- 23. htmlentities'无效的多字节序列'错误
- 24. 正在抛出normalize_yaml_input中的无效字节序列错误?
- 25. Python错误:'utf8'编解码器无法解码位置85中的字节0x92:无效起始字节
- 26. PG ::错误:错误:无效的字节序列编码“UTF8”:0xed2020(Sequel :: DatabaseError)通过水龙头导入MySQL到PostgreSQL
- 27. 多字节的UTF8字符
- 28. boost :: endian和非1字节原子字节顺序?
- 29. Java编码SHA-1字节阵列
- 30. Java中的字符是1个字节还是2个字节?