Skip to content

About Serialization Error invalid UTF-8 byte at index #3414

@TimelifeCzy

Description

@TimelifeCzy

Description

Chinese deserialization error

Reproduction steps

#include <json.hpp>
using json_t = nlohmann::json;
std::string ch="中文";
json_t j;
j["ch_debug"]=ch.c_str();
j.dump();

Expected vs. actual results

try_

Minimal code example

#include <json.hpp>
using json_t = nlohmann::json;
std::string ch="中文";
json_t  j;
j["ch_debug"]=ch.c_str();
j.dump();

Error messages

JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + ss.str(), BasicJsonType()));

Compiler and operating system

win10 20he - IDE vs2019

Library version

3.10.5

Validation

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: invalidthe issue is not related to the library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions