Suppose we have a document code.cpp , which was saved in windows-1251 encoding:
//.......header char z = 172 std::cout<< z << std::endl; // выведет ¬ //....... Deduced what we expected, drag. The encoding is such and the symbol corresponds to it, but on the other hand, if we are on Windows, the console will work with the OEM (Кодировка 866) encoding OEM (Кодировка 866) , and in this encoding the number 172 denotes a completely different character, namely м .
How is that? If the console reproduces the result, then should it not display it in its encoding?
м, but byte with code 172. It does not recode it itself, since it does not know anything about the encoding in which this byte is interpreted by the program. The conversion task lies on the runtime library (which is most likely lazy). - VladD