Rapidjson parser does not recognize € or korean chars in utf8 encoded files

24 Views Asked by At

I try to read a utf8 encoded json file with a special character € and various korean characters.

file content: {"test":"this is german ä ü ö and € and this is korean 가 나 다"}

code:
std::ifstream ifs("utf8.txt");
rapidjson::IStreamWrapper isw( ifs );
rapidjson::Document doc;
doc.ParseStream( isw );
const char* cc = doc["test"].GetString();
const rapidjson::Value& test = doc["test"];
std::string s = test.GetString();

if i inspect cc,test or s, neither in cc nor in test nor in s the characters are not displayed correctly. The document has no parser errors. What am i doing wrong? Compiler is Visual Studio 2019, iso c++ 14 standard. Target is a windows or console app, that doesn't matter.

expected:
cc=this is german ä ü ö and € and this is korean 가 나 다
test = this is german ä ü ö and € and this is korean 가 나 다
s=this is german ä ü ö and € and this is korean 가 나 다

result: this is german ├ñ ├╝ ├ and Ôé¼ and this is korean Û░Ç Ùéÿ Ùïñ

0

There are 0 best solutions below