Incomplete UTF8 encoding in the windows 7 console
The project has source files in UTF8 encoding, the code has Russian text that is sent to the console for output. I compile MS with the compiler. Windows 7 OS. Not all letters are output to the console.
Test code:
#include <iostream>
#include <windows.h>
using namespace std;
int main(){
SetConsoleCP(65001);
SetConsoleOutputCP(65001);
cout << "Передача" << endl;
return 0;
}
Output to the console:
3
1 answers
The solution for those who use QtCreator (my version 3.6.0) under windows 7 with MS compiler. So that QtCreator can edit files in CP 1251 encoding, go to инструменты->параметры->текстовый редактор->поведение->кодировки файлов->по умолчанию
and set the value CP1251 (windows). Then, if you have files in a different encoding, we will convert them to the cp1251 encoding using any available utility, restart QtCreator and that seems to be all.
Code:
#include <iostream>
#include <windows.h>
using namespace std;
int main(){
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
cout << "Передача" << endl;
return 0;
}
Output:
1
Author: perfect, 2016-07-08 14:39:38