Client Server C++ Python?

Learning C++ and parallel to dabble with Python, decided to write a simple console chat.
As Clint will be the C++ application, as server Python script.
The problem is that sending a message with C++, Python did not seem to cause any problems, but Cyrillic is not sent (in Python some Chinese characters issue)
But sending messages from Python to C++ causes one problem.

In the console I get the C++ message, and at the end of some incomprehensible gibberish, I understand that maybe some problem with encoding, but most importantly, the message displays all (of course only numbers and Latin), and in the end no matter how cool some characters.
Please help.
March 19th 20 at 09:04
1 answer
March 19th 20 at 09:06
Solution
Solution:
In Python the message encode encoded Windows1251
data = 'some message'
data.encode('cp1251')

In C++ to support encoding when outputting to the console with 2 lines of code:
SetConsoleCP(1251);
SetConsoleOutputCP(1251);

Also in C++ you need after creating an array, where the message is accepted:

char message[256]; //create an array for the message
std::memset(message, 0, sizeof message); //garbage cleaning
recv(ConnectServer, message, sizeof(message), NULL); //message acceptance
std::cout << message << std::endl; //display message on the screen


That's the whole secret.

Find more questions by tags C++Python