Using wstring and wchar_t in c ++, there was a problem outputting intermediate information to the console. Project coding costs UTF-8. If you change to UTF-16, then the problem will remain, but hieroglyphs will be added.
wcout << L"Text"; // Выводится нормально. wcout << L"Текст на русском"; // Не выводится. wcout << L"Text"; // Не выводится, хотя уже английские буквы. cout << "Выводится"; // cout работает нормально. There is a use of cout , then everything is fine, but my data is stored in wchar_t and wstring so cout does not fit.
The windows.h library on mac os is not available, so SetConsoleSp and so on are not suitable. setlocale didn't help either.
I tried to change the font and encoding, to combine them, but nothing helps.
PS I understand that there were already similar questions on the output to the console, but following those instructions I could not make a readable result for processing and output to the console.
Test code:
#include <iostream> #include <string> #include <clocale> using namespace std; int main() { wcout << L"Text" << endl; wcout << L"Русский текст" << endl; wcout << L"Text" << endl; return 0; } At the output (terminal mac os) only the word Text.
CLionfromJetbrains. The compiler -CMake(there fromxcode'a) - kot_mapku3