there is a json file like this, without bom, use gbk code set. The boost::property_tree can parse it successfully in the majority.
try {
boost::property_tree::read_json(filename, tree);
}
catch (exception &e) {
cerr << e.what() << endl;
}
However, if the file has chinese character"历"(c0fa)or"繞"(c040), the property_tree will throw exception"invalid code sequence"
You could try to use the overload that takes a stream and imbue a proper locale before hand:
Where you use Boost Locale to generate a locale e.g., on POSIX:
And then imbue that: