Comments (13)
现在就支持bom
from xpack.
在windows下解析UTF8带BOM的文件时就会报下面错误,就是没有支持BOM文件,去掉BOM的头就可以解析正确了
strError | "Parse json file "cfg/DataBrowserConfig.json" fail. err=Invalid value.. offset=锘縶\r\n\t"Description":"A Simulati" | std::basic_string<char,std::char_traits,std::allocator >
from xpack.
这个和bom没关系,应该是编码导致的,现在不支持gbk编码
from xpack.
from xpack.
贴一下json
from xpack.
{
"Description":"A Simulation Program",
"Version":"V1.0",
"DomainId":23
}
from xpack.
解析用的
xpack::json::decode_file("cfg/DataBrowserConfig.json", sConfigInfo);
from xpack.
我明天看看
from xpack.
像最开始那样在解析文件函数里面添加删除BOM头就可以成功解析,最开始里面有代码。好的,谢谢!
from xpack.
试了一下,Ubuntu(gcc)/Windows(msvc 2019)都是正常的,rapidjson处理了BOM了:https://github.com/xyz347/xpack/blob/master/rapidjson/encodedstream.h#L72
from xpack.
我用的VS2017
此处定义了一个strDeleteBom字符串,去掉BOM头,看到Json是正常的,作为对比
通过两张图对比,当报错时,数据仍然是未去掉BOM头的内容,并且过程中没有调用到encodedstream.h#72这里
from xpack.
用最新的xpack的代码
from xpack.
最新版本是可以的,
from xpack.
Related Issues (20)
- 请问大佬,这种嵌套的坐标数组应该如何构建结构体 HOT 3
- decode {"apps": ["person"] } crash
- customize basetype's serialisation HOT 2
- enum class Enum : int64_t解析会出错 HOT 3
- Is it possible to add support for enum key based std::map? HOT 2
- 含转义符 string encode结果格式错误 HOT 3
- float类型怎么限制位数 HOT 2
- 能否支持字段自定义校验函数 HOT 8
- union支持情况 HOT 3
- 报文里有parameter1这个字段,但解析映射到的结构体不需要这个,会报这个错?
- 这个XPACK(A(1,a_1),A(2,a_2))里面的A()有映射个数限制么, 好像加到某个值之后,编译都是报错了 HOT 6
- 请问下,这个版本的xpack依赖的rapidjson用的是哪个tag HOT 3
- decode错误时提示Error类型 HOT 1
- Silent error with overflowed integer HOT 1
- windows下Qt + MSVC报以下错误:use of undeclared identifier 'X_PACK_L1_ENCODE' HOT 2
- demo能运行,但是复制xml.cpp到项目中XPACK提示use of undeclared identifier NULL HOT 1
- X_PACK_FLAG_ATTR传进去后似乎没用起作用 HOT 8
- return-statement with a value, in function returning ‘void’ HOT 1
- clang 16.0.0-x86_64-pc-windows-msvc下编译不过 HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xpack.