Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[C] How to write Russian characters to Windows console
// Tested on Windows 7 X86-64 with MinGW-w64 GCC.
...
#include <windows.h>
#include <locale.h>
#include <wchar.h>
...
// Make sure you have Lucida Console or Consolas font installed and choose it as the console font.
// Set the specified system locale to 'Russian_Russia.1251'.
setlocale(LC_ALL, "Russian");
// Set CP1251 instead of default CP866 to output Cyrillic text.
SetConsoleOutputCP(1251);
// In most cases the trick should do the job. No warranty though: it's Windows, baby.
wprintf(L"Сообщение\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment