xml 3 字节的 UTF-8 序列的字节 3 无效
今天在eclipse中编写**.xml文件时,注释中的中文被eclipse识别到错误:3 字节的 UTF-8 序列的字节 3 无效,曾多次遇到该问题,问题的根源是:
The cause of this is a file that is not UTF-8 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.
但这次很诡异,我使用notepad++将pom.xml的编码保存为“UTF-8无BOM”形式,pom.xml文件内的encoding属性设置为“UTF-8”,问题依旧啊,郁闷了,难道上述的理论有问题?还是eclipse的bug呢?在网上看了半天,基本都是这么说的。
第一,可以直接在XML文件中更改UTF-8为GBK或GB2312
<?xml version="1.0" encoding="GB2312"?>
第二,可以在Eclipse中更改,在 eclipse 的功能表 [Project]→[Properties],點選 [Resources],在右邊的「Text file encoding」,把原來是系統預設的編碼,改為 「UTF-8」
但是考虑到不能改成GB类的编码,所以把xml的encoding属性值UTF-8改为UTF8就可以了
实际操作的时候,发现XML配置文件太多,不可能一个个改,在一个之前是正常的,所以这种方案放弃,最终解决为设置spelling编码及workspace编码,然后将项目删除重新导入,正常
如果还不行,POM文件添加编译编码
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

xml 3 字节的 UTF-8 序列的字节 3 无效的更多相关文章
- eclipse xml 编码问题 “3 字节的 UTF-8 序列的字节 3 无效”
原本项目没问题,git commit之后,突然报错 “3 字节的 UTF-8 序列的字节 3 无效” 尝试过改xml文件编码等,没成功.pom中设置属性,成功解决 <project.build. ...
- Xml解析过程中遇到“” 1 字节的 UTF-8 序列的字节 1 无效“”问题---idea与eclipse同适用
转载自:http://blog.csdn.net/zhangzhikaixinya/article/details/7727938 今天在eclipse中编写pom.xml文件时,识别到错误:Inva ...
- XML文件存在中文注释报错问题( 3 字节的 UTF-8 序列的字节 3 无效)
今天在做mybatis项目的时候,给映射文件添加了中文注释后,程序就报错.把中文注释删除后,程序又可以正常执行.解决方法在下文提到. 我的xml映射文件如下: <?xml version=&qu ...
- Error building SqlSession. ### The error may exist in dao/UserMapper.xml ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration(2 字节的 UTF-8 序列的字节 2 无效。)
关于在学习Mybatis框架时运行报错 Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error building ...
- org.dom4j.DocumentException : 1 字节的 UTF-8 序列的字节 1 无效。 Nested exception: 1 字节的 UTF-8 序列的字节 1 无效。
org.dom4j.DocumentException : 1 字节的 UTF-8 序列的字节 1 无效. Nested exception: 1 字节的 UTF-8 序列的字节 1 无效. 网上查了 ...
- JAVA中遇到 UTF-八 序列的字节 1 无效
UTF-8 序列的字节 1 无效用dom4j操作xml文件, 出现了这个错误.原因是xml文件被创建的时候是ansi码格式. ( UTF-8 序列的字节 1 无效用dom4j操作xml文件, 出现 ...
- com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 无效。
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document fro ...
- Maven 项目 启动时 解决3 字节的 UTF-8 序列的字节 3 无效
"org.activiti.bpmn.exceptions.XMLException: 3 字节的 UTF-8 序列的字节 3 无效." Maven 项目启动时,由于读XML配置文 ...
- 3 字节的 UTF-8 序列的字节 2 无效
由于目前写完了[消息队列]模块,想做个单元测试,所以就利用spring的import标签,将mq的配置文件加入了配置.结果出现了<3 字节的 UTF-8 序列的字节 2 无效>这个问题. ...
随机推荐
- Graylog-centos安装
graylog安装 1.先决条件 yum install java-1.8.0-openjdk-headless.x86_64 -y #安装java软件包 yum install epel-relea ...
- JPA 报错:Page 2 of 1 containing UNKNOWN instances
JPA 中,page是从0开始,不是从1开始: 因此,将用户输入的从1开始的page页码减1: PageRequest pageRequest = PageRequest.of(page - 1, p ...
- OpenGL是什么?GPU是什么?
一.GPU与CPU CPU是处理基本算数运算的单元:它处理的数据是数:整型.浮点型.bool等等: GPU是处理图形运算的单元:它处理的数据是图形的数据矩阵: GPU的输入是一个和多个图形,输出是 ...
- Java Polymorphism
Ability of an organism to take different shapes is polymorphism in bio world. A simplest definition ...
- 数据库plsql配置
https://jingyan.baidu.com/article/d8072ac4957b28ec95cefd9f.html
- Common Substrings POJ - 3415 (后缀自动机)
Common Substrings \[ Time Limit: 5000 ms\quad Memory Limit: 65536 kB \] 题意 给出两个字符串,要求两个字符串公共子串长度不小于 ...
- React-HelloWorld
React-HelloWorld 最简单的React示例如下: ReactDOM.render( <h1>Hello,world!</h1>, document.getelem ...
- ex2
#include <stdio.h> int main() { int days; printf("输入一个整数: \n"); scanf("%d" ...
- Mongoose 两个表关联查询aggregate 以及 Mongoose中获取ObjectId
Mongoose 两个表关联查询aggregate 通常两个表关联查询的时候,是一种一对多的关系,比如订单与订单详情就是一对多的关系,一个订单下面有多个商品 数据模拟 首先我们先将数据模拟出来,先选择 ...
- ppt使用记录之添加带圈的20以内的数字编号