Closed
Description
I have some problems with parsing UTF-8
Here is my code
#include <iostream>
#include <string.h>
#include "nlohmann/json.hpp"
using json = nlohmann::json;
int main()
{
json j1 = "{\"name\":\"\\u6211\"}"_json;
json j2 = json::parse(R"({ "name" : "\u6211" })");
std::cout << j1.dump() << std::endl;
std::cout << j2.dump() << std::endl;
system("pause");
return 0;
}
I think I should get output like :
{"name":"我"}
{"name":"我"}
but I only get:
{"name":"?
If I do auto temp = j1["name"].get<std::string>();
temp will have Invalid character in string.
Are there anyone could help me to fix it?