I want to create a program which is sort of a dictionary for greek words in C++ and I am using CodeBlocks. The problem is that I can't figure out how to read and write non ASCII characters to and from the console and files. I have tried various methods I found online, like using wchar_t, char32_t and more but none of them worked for me.
wchar_t c;
wcin>>c;
wcout<<c<<"\n";
The above code worked for "simple" greek letters, 'α' for example. It did not work with polytonic letters like 'ᾧ'. Specifically, polytonic greek letters appeared as question marks in the console whenever I typed them in.
wchar_t c;
wifstream wfin("test_unicode.txt");
wfin>>c;
wcout<<c<<"\n";
The above code did not work for any input, even latin characters. The output was always blank.
wchar_t c = 'α';
wcout<<c<<"\n";
Also I haven't been able to initialize wchar_t or wstring variables with greek letters within the program, the above code prints nothing on my screen.
Please help!