转载自:http://blog.csdn.net/zhangzhikaixinya/article/details/7727938
今天在eclipse中编写pom.xml文件时,识别到错误:Invalid byte 1 of 1-byte UTF-8 sequence,1 字节的 UTF-8 序列的字节 1 无效,问题的根源是:
The cause of this is a file that is not is being parsed as UTF-8. It is likely that the parser is encountering a byte value in the range
FE
-FF
. These values are invalid in the UTF-8 encoding.
修改方式如下:
第一,可以直接在XML文件中更改UTF-8为GBK或GB2312
<?xml version="1.0" encoding="GB2312"?>
第二,可以在Eclipse中更改,在 eclipse 的功能表 [Project]→[Properties],点击[Resources],在右边的「Text file encoding」,把原来系统预设的编码格式改为:「UTF-8」。
第一种方案可行,属于逃避的方法,放弃!第二种也不是解决我这种问题的,继续网上搜索惊奇的发现,原来解决方案是这样的:
第三:错误原因是保存文件的编码,同xml中写的编码不统一,我是通过记事本打开该文件,选择另存为时,可以选择文件保存的类型,选择utf-8,如下图所示