C++ Invalid characters in string

C++ Invalid characters in string

I'm debugging program, and mouse hang on somestring variable strFoo , it shows "Invalid characters in string".

and I find that I can first add a line of code system("chcp 65001") and add another line code cout << strFoo << endl;  

then run the code, can successfully print the string, and see its content.