编码问题Invalid byte 3 of 3-byte UTF-8 sequence.

1.Configuration problem: Failed to import bean definitions from URL location [classpath:spring/*Bean.xml]

2.Parsing XML document from file [D:\Program Files (x86)\Tomcat1\webapps\kissflovewebsite

\WEB-INF\classes\spring\NormalBean.xml];

nested exception is java.io.UTFDataFormatException: Invalid byte 3 of 3-byte UTF-8 sequence.

出现这个异常无非是编码问题,可以按下面步骤依次排除异常:

1、检查抛错的那个xml文件,查看里面是否有中文,有中文把中文删掉是可以解决问题的。

2、如果中文是有用不能删的内容,那可以把<?xml version="1.0" encoding="UTF-8"?>改成<?xml version="1.0" encoding="gbk"?>

3.BeanFactory not initialized or already closed - call ‘refresh‘ before accessing beans via the ApplicationContext

这里其实可以看出是bean配置文件出了问题、在向上观察、是编码出现问题、依上解决

时间: 2024-08-06 16:01:13

编码问题Invalid byte 3 of 3-byte UTF-8 sequence.的相关文章

图片和base64编码字符串 互相转换,图片和byte数组互相转换

图片和base64编码字符串 互相转换 import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import java.io.*; /** * @author lishupeng * @create 2017-05-06 下午 2:56 **/ public class Base64Test { public static void main(String[] args) { String strImg = GetImageSt

java int转byte和long转byte

在网络编程中,出于节约带宽或者编码的需要,通常需要以原生方式处理long和int,而不是转换为string. public class ByteOrderUtils { public static byte[] int2byte(int res) { byte[] targets = new byte[4]; targets[3] = (byte) (res & 0xff);// 最低位 targets[2] = (byte) ((res >> 8) & 0xff);// 次低

pyquery 读取HTML报错UnicodeDecodeError: &#39;gbk&#39; codec can&#39;t decode byte 0xaf in position 78: illegal multibyte sequence

今天学习pyquery 读取HTML文件时,报错 这是字符编码错误,读取的时候不能读取gbk格式的字符 然后打开HTML文档,发现里面有中文字符,将中文字符去掉之后就可以执行了. pyquery 读取HTML报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 78: illegal multibyte sequence 原文地址:https://www.cnblogs.com/zll20153246/p/963

&#39;gbk&#39; codec can&#39;t decode byte 0xaa in position 4294: illegal multibyte sequence

使用python的时候经常会遇到文本的编码与解码问题,其中很常见的一种解码错误如题目所示,下面介绍该错误的解决方法,将'gbk'换成'utf-8'也适用. (1).首先在打开文本的时候,设置其编码格式,如:open('1.txt',encoding='gbk'): (2).若(1)不能解决,可能是文本中出现的一些特殊符号超出了gbk的编码范围,可以选择编码范围更广的'gb18030',如:open('1.txt',encoding='gb18030'): (3).若(2)仍不能解决,说明文中出现

python3安装xadmin出现 UnicodeDecodeError: &#39;gbk&#39; codec can&#39;t decode byte 0xa4 in position 3444: illegal multibyte sequence

python3的环境安装xadmin时,直接pip install xadmin出现 Downloading xadmin-0.6.1.tar.gz (1.0MB) 100% |████████████████████████████████| 1.0MB 547kB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>&qu

&#39;gbk&#39; codec can&#39;t decode byte 0xad in position 12: illegal multibyte sequence

原文链接:https://blog.csdn.net/shijing_0214/article/details/51971734 使用python的时候,经常会遇到文本编码的问题,其中最常见的就是“'gbk' codec can't decode byte 0xad in position 12: illegal multibyte sequence”. 解决方法:将“gbk”转化成utf8 也可以这样用. 在打开文本的时候,设置编码格式   open('1.txt',encoding='gbk

UnicodeDecodeError: &#39;gbk&#39; codec can&#39;t decode byte 0xe9 in position 7581: illegal multibyte sequence

pyhon读取文件时报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xe9 in position 7581: illegal multibyte sequence 代码如下: #获取电影列表 def getMovieList(item): items={} f=open(item,"r") # 此句报错 movie_content=f.readlines() f.close() for movie in movie_conte

UnicodeDecodeError: &#39;gbk&#39; codec can&#39;t decode byte 0xae in position 9: illegal multibyte sequence

上面是遇到的错误,本来想完成读文件,再写入另一文件的.但是在 fp.read() 时,一直遇到上面的错误,经过各种百度,google, 还有神奇的 stackoverflow 才知道是字符流的问题. 知道问题所在,还是没有解决,又苦苦搜索,终于在 stackoverflow 上找到灵感,可以把 open 的方式变为 二进制,也就是下面代码里的 open(filename,'rb'), 这下好了,至少后面的read() 可以通过. 再之后就产生了以下代码,发现问题的路真心不好走,在此mark 下.

python 读取文件时报错UnicodeDecodeError: &#39;gbk&#39; codec can&#39;t decode byte 0x80 in position 205: illegal multibyte sequence

python读写txt文件转化成excel文件 python读取文件时提示"UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 205: illegal multibyte sequence" 解决办法1. FILE_OBJECT= open('order.log','r', encoding='UTF-8') 解决办法2. FILE_OBJECT= open('order.log','rb') pyth

UnicodeDecodeError: &#39;gbk&#39; codec can&#39;t decode byte 0xbc in position 21: illegal multibyte sequence

Save the txt with UTF format and then open the file with f1 = open(path, encoding = 'utf') UnicodeDecodeError: 'gbk' codec can't decode byte 0xbc in position 21: illegal multibyte sequence