解决方法:

在web.xml增加如下配置:
<filter> 
<filter-name>encodingFilter</filter-name> 
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
<init-param> 
<param-name>encoding</param-name> 
<param-value>UTF8</param-value> 
</init-param> 
<init-param> 
<param-name>forceEncoding</param-name> 
<param-value>true</param-value> 
</init-param> 
</filter>

然后再改一下数据库连接
jdbc:mysql://localhost/mydb?useUnicode=true&characterEncoding=utf-8

然后在MYSQL软件中更改对应字段为UTF-8编码;

纠错结果:

在配置一个访问数据库的Url时,第一次设置的内容如下:

jdbc:mysql://localhost:3306/photo?useUnicode=true&characterEncoding=UTF-8,注意中间那个“&”,在xml中这个是读不出的,正确写法将“&”转义“&amp;”:

jdbc:mysql://localhost:3306/photo?useUnicode=true&amp;characterEncoding=UTF-8

分析:

有时候在使用xml作为配置文件的时候,应该要使用xml的编码规则来进行适当的设置。

下面给出xml中一些特殊符号的编码转换:

 &lt;  <  小于号
 &gt;  >  大于号
 &amp;  &  and字符
 &apos;  '  单引号
 &quot;  "  双引号

XML报错:The reference to entity "characterEncoding" must end with the ';' delimite的更多相关文章

  1. Caused by: org.xml.sax.SAXParseException: The reference to entity "characterEncoding" must end with the ';' delimiter.

    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Sourc ...

  2. java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

    java关于报错:The reference to entity "characterEncoding" must end with the ';' delimiter. Java ...

  3. xml文件中配置JDBC源遇到问题 : The reference to entity "characterEncoding" must end with the ';' delimiter

    数据源配置时加上编码转换格式后出问题了: The reference to entity"characterEncoding" must end with the ';' deli ...

  4. 在java的xml文件配置数据库URL地址时提示The reference to entity "characterEncoding" must end with the ';' delimiter.错误信息

    配置数据库的URL<property name="url" value="jdbc:mysql://127.0.0.1:3306/micro_message&quo ...

  5. android 程序中res/values-v14/styles.xml报错的解决办法

    从旧的ADT迁移的新的ADT时, android 程序中res/values-v14/styles.xml报错: error: Error retrieving parent for item: No ...

  6. The reference to entity "characterEncoding" must end with the ';' delimiter

    数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...

  7. The reference to entity "characterEncoding" must end with the ';' delimiter (Mybatis + Mysql)

    数据源配置时加上编码转换格式后出问题了: The reference to entity "characterEncoding" must end with the ';' del ...

  8. 新建maven工程时pom.xml报错

    新建maven工程时,pom.xml报错:第一行报如下错误:multiple annotations found at this line后添加org.eclipse.m2e相关的plugin配置后, ...

  9. eclipse中Maven项目pom.xml报错:com.thoughtworks.xstream.io.HierarchicalStreamDriver

    eclipse中创建Maven项目时 pom.xml报错:com.thoughtworks.xstream.io.HierarchicalStreamDriver 解决方案1.在pom文件中加入mav ...

随机推荐

  1. utf8_unicode_ci、utf8_general_ci区别

    摘录一下Mysql 5.1中文手册中关于utf8_unicode_ci与utf8_general_ci的说明:   当前,utf8_unicode_ci校对规则仅部分支持Unicode校对规则算法.一 ...

  2. 超实用!9个目前流行的MATERIAL DESIGN前端框架

    http://www.uisdc.com/material-design-frameworks-top-9 谷歌推出的Material Design风格已见有一些APP UI采用,视觉和交互体验都很棒 ...

  3. linux下打开文件、编辑文本cat\gedit\nano

    cat: 文本编辑器:gedit.nano,要获得根权限,在前面加上sudo

  4. SAS DATA ENCODING 解决odbc乱码问题

    首先获取编码格式: %PUT %SYSFUNC(getOption(ENCODING)); libname findoout ODBC datasrc=SurveyReport user=shendu ...

  5. webSocket+HeadBeat

    最近需要用到webSocket,来实时接收长链接发送过来的信息,同时又要发送心跳给服务端.直接贴代码吧. var ws;//websocket实例 var heartCheck; var lockRe ...

  6. 文本adversarial examples

    对文本对抗性样本的研究极少,近期论文归纳如下: 文本对抗三个难点: text data是离散数据,multimedia data是连续数据,样本空间不一样: 对text data的改动可能导致数据不合 ...

  7. elasticsearch 外网访问9200端口访问

    可以访问127.0.0.1:9200,但不能访问 公网IP:9200 后面ip就是127.0.0.1的局域网ip,如何解决? 修改配置文件 config/elasticsearch.yml netwo ...

  8. 用tmux工具给linux命令行分栏

    介绍 有时候我们需要在命令行里同时开多个程序,但是每个程序都会占用命令行,这时候可以用tmux,给命令行界面分栏. 基本概念 tmux是分多层的 会话>窗口(我下文称作:页)>面板(或者叫 ...

  9. TreeSet多字段排序

    package st; public class PersonBean implements Comparable<Object>{ private String name; privat ...

  10. Snort规则大探秘

    版本联系 Snort规则可以用来检测数据包的不同部分.Snort 1.x可以分析第3层和第4层的信息,但是不能分析应用层协议.Snort v 2.x增加了对应用层头部分析的支持.所有的数据包根据类型的 ...