Invalid byte 1 of 1-byte UTF-8 sequence

 XML内容实际是以UTF-8编码的,因此造成了包括中文字符的XML文件无法正常阅读,将编码格式改成“GB2312”后就可以正常解析了。<?xml   version="1.0"   encoding="GB2312"?> 

 

1、“org.dom4j.DocumentException: Invalid byte 1 of 1-byte UTF-8 sequence.”异常分析和解决: 
分析: 
该异常由下面的reader.read(file);语句抛出: 
SAXReader reader = new SAXReader(); 
Document doc = reader.read(file); 

产生这个异常的原因是: 
所读的xml文件实际是GBK或者其他编码的,而xml内容中却用<?xml version="1.0" encoding="utf-8"?>指定编码为utf-8,所以就报异常了! 


注意你eclipse 工具的编码是什么?如何是gbk,你文档是utf-8  那就会出问题了。

http://blog.csdn.net/chenyanbo/article/details/6866941

你可能感兴趣的:(sequence)