Invalid character in the given encoding. Line XX, position XX.解决方法

简介: 最近在通过load函数,获取config文件中信息的时候,提示上面的错误,动手找资料发现是,config文件开头信息的问题。解决方法: 打开对应的config XML文件,看它的第一行 <?xml version="1.0" encoding="utf-8"?> 将encoding="utf-8"改为 encoding="gb2312" 即可。 或者 <?xml v
最近在通过load函数,获取config文件中信息的时候,提示上面的错误,动手找资料发现是,config文件开头信息的问题。

解决方法:

打开对应的config XML文件,看它的第一行 <?xml version="1.0" encoding="utf-8"?> 将encoding="utf-8"改为 encoding="gb2312" 即可。

或者 <?xml version="1.0"?>中加上encoding="gb2312" 即可。

原来是由于该XML文件中存在汉字。所以要改编码方式。

相关文章
|
4月前
|
XML C# 数据格式
The data at the root level is invalid. Line 1, position 1.
The data at the root level is invalid. Line 1, position 1.
26 0
|
10月前
|
前端开发
CSS安装出错:Unicode Character Check -> Your temp directory path contains Unicode characters........
CSS安装出错:Unicode Character Check -> Your temp directory path contains Unicode characters........
247 0
|
应用服务中间件 nginx Windows
1113: No mapping for the Unicode character exists in the target multi-byte code page
1113: No mapping for the Unicode character exists in the target multi-byte code page
216 0
1113: No mapping for the Unicode character exists in the target multi-byte code page
|
程序员 算法框架/工具 Caffe
解决办法:error: 'size_t' does not name a type、unknown type name 'size_t'
解决办法:error: 'size_t' does not name a type、unknown type name 'size_t'
599 0
ini_set ("display_errors","On"); 和 error_reporting (E_ALL);
ini_set ("display_errors","On"); 和 error_reporting (E_ALL);
SyntaxError: Non-ASCII character '\xe8' in file lane_detector.py on line 5, but no encoding declared;
在进行编译运行的时候报的错,此错是中文乱码的问题,就算是注释也不行.我们需要指定字符集
成功解决SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xa3 in position 15: invalid start
成功解决SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xa3 in position 15: invalid start
|
Python
SyntaxError: Non-ASCII character '\xc4' in file newYear.py on line 6, but no encoding declared;
版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/79293467 ...
1300 0