Description


Reproduction steps
100% reproduction
Expected vs. actual results
struct Person {
std::string name;
int age;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Person, name, age)
};
Person person;
person.name = "中文字符";
person.age = 23;
nlohmann::json js = person;
const char *str = js.dump().c_str();
js.dump().c_str(); This will make the string garbled
but js.dump() assignment to std::string show the correct string
Minimal code example
No response
Error messages
No response
Compiler and operating system
ohos 5.0
Library version
current version
Validation
Description
Reproduction steps
100% reproduction
Expected vs. actual results
struct Person {
std::string name;
int age;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Person, name, age)
};
Person person;
person.name = "中文字符";
person.age = 23;
nlohmann::json js = person;
const char *str = js.dump().c_str();
js.dump().c_str(); This will make the string garbled
but js.dump() assignment to std::string show the correct string
Minimal code example
No response
Error messages
No response
Compiler and operating system
ohos 5.0
Library version
current version
Validation
developbranch is used.