How to display unicode characters in console application

Jul 21, 2014 at 12:57pm
Hello everyone, is there a way to display unicode characters in my console application? Am using Code::Blocks
Thanks!!
Jul 21, 2014 at 1:16pm
Yes and no. You can send Unicode data to the console in a number of ways -- for example, with std::wcout -- but whether the data will be displayed as anything other than a series of question marks is entirely up to the terminal emulator the user is using.
Under Linux, emulators have for quite some time been able to display Unicode.
Under Windows, the only emulator I've found that worked for me in this regard is ConEmu. I suggest you check it out.
Jul 21, 2014 at 1:26pm
if your using windows/ms-dos you can use extended ASCII characters but i don’t think you can use Unicode
on a console app without using a weird OS
or a console emulator
what program are you trying to make?
Jul 21, 2014 at 3:20pm
helios thanks for your answer but, when I try to use std::wcout my compiler generates error message "error: 'wcout' is not a member of 'std' " what does that mean? Am using Code::Blocks I think this will work on visual studio only. And,
tomplusplus am new to programming. And am from Ethiopia so I want to develop programs using our letters. Thats why I need the support of unicode until I become familiar with GUI programmig.
Jul 21, 2014 at 3:28pm
Get a better compiler, then. std::wcout is standard.
Jul 21, 2014 at 3:35pm
Ok after I compile the program do the characters can be seen on other pcs?
Jul 21, 2014 at 4:09pm
I wrote:
whether the data will be displayed as anything other than a series of question marks is entirely up to the terminal emulator the user is using
Jul 21, 2014 at 4:55pm
So it is not good to use unicode characters on console programs. Ha?
Thank you very much
Jul 21, 2014 at 5:25pm
On windows std::wcout does not work as expected if you are using alone:
1
2
3
4
5
6
7
8
9
#include <iostream>
#include <io.h>
#include <fcntl.h>

int wmain(int argc, wchar_t* argv[])
{
    _setmode(_fileno(stdout), _O_U16TEXT);
    std::wcout << L"Testing unicode -- English -- Ελληνικά -- Español." << std::endl;
}


This works, but requires the console font to be set as Lucida Console (which is not the default unfortunately).
Topic archived. No new replies allowed.