Faced an interesting behavior of the setvbuf function when working with Cyrillic. Question: why such a code cannot display the Cyrillic alphabet (text comes via cURL request in utf-8 encoding)

int main() { SetConsoleOutputCP(CP_UTF8); char text [512] {}; cout << text << std::endl; return 0; } 

Result

and the same, but with the line setvbuf (stdout, nullptr, _IOFBF, 2) can already

 int main() { SetConsoleOutputCP(CP_UTF8); setvbuf(stdout, nullptr, _IOFBF, 2); char text [512] {}; cout << text << std::endl; return 0; } 

enter image description here

Debagger shows that the overload for cout is the same in both the first and second cases.

    0