今天在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 无效的更多相关文章

  1. eclipse xml 编码问题 “3 字节的 UTF-8 序列的字节 3 无效”

    原本项目没问题,git commit之后,突然报错 “3 字节的 UTF-8 序列的字节 3 无效” 尝试过改xml文件编码等,没成功.pom中设置属性,成功解决 <project.build. ...

  2. Xml解析过程中遇到“” 1 字节的 UTF-8 序列的字节 1 无效“”问题---idea与eclipse同适用

    转载自:http://blog.csdn.net/zhangzhikaixinya/article/details/7727938 今天在eclipse中编写pom.xml文件时,识别到错误:Inva ...

  3. XML文件存在中文注释报错问题( 3 字节的 UTF-8 序列的字节 3 无效)

    今天在做mybatis项目的时候,给映射文件添加了中文注释后,程序就报错.把中文注释删除后,程序又可以正常执行.解决方法在下文提到. 我的xml映射文件如下: <?xml version=&qu ...

  4. 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 ...

  5. 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 无效. 网上查了 ...

  6. JAVA中遇到 UTF-八 序列的字节 1 无效

    UTF-8 序列的字节 1 无效用dom4j操作xml文件, 出现了这个错误.原因是xml文件被创建的时候是ansi码格式. (   UTF-8 序列的字节 1 无效用dom4j操作xml文件, 出现 ...

  7. com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 3 字节的 UTF-8 序列的字节 3 无效。

    org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document fro ...

  8. Maven 项目 启动时 解决3 字节的 UTF-8 序列的字节 3 无效

    "org.activiti.bpmn.exceptions.XMLException: 3 字节的 UTF-8 序列的字节 3 无效." Maven 项目启动时,由于读XML配置文 ...

  9. 3 字节的 UTF-8 序列的字节 2 无效

    由于目前写完了[消息队列]模块,想做个单元测试,所以就利用spring的import标签,将mq的配置文件加入了配置.结果出现了<3 字节的 UTF-8 序列的字节 2 无效>这个问题. ...

随机推荐

  1. 【转】Linux虚拟网络基础——tap

    原文:https://blog.csdn.net/chengqiuming/article/details/80071073 ------------------------------------- ...

  2. js spread object

    What’s is the benefit / drawback of these two alternatives? Using object spread options = {...option ...

  3. bzoj1115&&POJ1704&&HDU4315——阶梯Nim

    BZOJ1115 题意:阶梯Nim游戏大意:每个阶梯上有一堆石子,两个人在阶梯上玩推石子游戏.每人可以将某堆的任意多石子向左推一阶,所有的石子都推到阶梯下了即算成功,即不能推的输. 分析:根据阶梯Ni ...

  4. Arduino通过串口监视器收发数据

    在串口监视器中发送数据,板子收到数据并打印出来. 不需要额外电路,但是板子必须连接电脑,Arduino IDE的串口监视器也需要被打开. 代码 /* 串口事件 当新的串口数据到来时,我们会将它添加到一 ...

  5. JS实现继承的几种方法

    父类: // 定义一个动物的类 function Animal (name) { // 属性 this.name = name || 'Animal'; // 实例方法 this.sleep = fu ...

  6. LeetCode 286. Walls and Gates

    原题链接在这里:https://leetcode.com/problems/walls-and-gates/ 题目: You are given a m x n 2D grid initialized ...

  7. eslint Cannot read property 'range' of null错误

    eslint Cannot read property 'range' of null错误   手动添加的配置,2个项目OK,还个项目 运行报错 Cannot read property 'range ...

  8. linux学习11 Linux基础命令及命令历史

    一.Linux系统上的文件类型 1.- :常规文件:在其它程序中用f表示.比如我们用ls -l命令查看的第一个内容 [root@localhost ~]# ls -l total -rw------- ...

  9. learning shell monitor prog function

    [Purpose]        Shell script monitor prog function   [Eevironment]        Ubuntu 16.04 bash env   [ ...

  10. Xamarin.Forms一些常见问题

    安装 1.查看Xaramin.Forms的版本 在vs项目中查看引用的包(Xamarin.Forms)的版本,或者直接进文件夹看 C:\Microsoft\Xamarin\NuGet\xamarin. ...