I am interested in displaying UTF-8 from a console application on Windows, without changing anything in the console from the user's side. Basically, what I want to do is display characters like "ა"
, but the output is not what I expect. The minimal code that shows this is below:
#include <iostream>
using namespace std;
int main() {
cout << "ა" << endl;
}
I compile it with mingw-w64 with the command g++ -o filename filename.cpp
.
Here is the output from the version
command:
g++ --version
g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Following is the output after compilation:
сГР
Of course, this isn't what I want. I've seen some solutions online, for example:
How do I print UTF-8 from c++ console application on Windows
http://cplusplus.com/forum/windows/9797/
How to print UTF-8 characters on console using C
But none of them work. That first StackOverflow question talks about some fonts, but I want to do it automatically without any interaction from the user's side. The last one as well, however that is with a different compiler.
I know this is possible, as far as I know, at least python3 is written in C or C++, it supports UTF-8 by default, so I'm guessing technically that is possible. How, I have no idea.