Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for Object Multiplex #2013

Closed
TimelifeCzy opened this issue Apr 2, 2022 · 0 comments
Closed

for Object Multiplex #2013

TimelifeCzy opened this issue Apr 2, 2022 · 0 comments

Comments

@TimelifeCzy
Copy link

TimelifeCzy commented Apr 2, 2022

code:

std::vector<std::string> vec_task_string;
rapidjson::Document document;
document.SetObject();
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
for (xxx)
{
    buffer.Clear();
    writer.Reset(buffer);
    document.AddMember(rapidjson::StringRef("xxxxxx"), rapidjson::StringRef(tmpstr.c_str()), document.GetAllocator());
    document.Accept(writer);
    vec_task_string.push_back(buffer.GetString());
}
  1. buffer.Clear(); --> invalid
  2. writer.Reset(buffer); --> don't know if it's correct

need help thanks!

TimelifeCzy added a commit to theSecHunter/Hades-Windows that referenced this issue Apr 3, 2022
rapidjson复用有些不熟悉,详细:
Tencent/rapidjson#2013
更替为nlohmann_json,但中文反序列化时候不友好utf8,详细:
nlohmann/json#3414
后续如果没有对应的api解决,将引入boost::uft8编码转换后在反序列化,所以数据只要是string都要处理,因为不知道是否有中文,否则序列化将抛出异常.
@TimelifeCzy TimelifeCzy reopened this Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant