Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing utf8 chars in a console app

Status
Not open for further replies.

beier

Technical User
May 6, 2006
10
DK
I'm trying to make chess in a console application, and at the moment im just using letters to represent the pieces. I seen that in the utf-8 charecter set, you can find actual chess pieces, but im having some trouble printing them.

After looking on the net a bit, i have tried

SetConsoleOutputCP(65001);
wcout<<'?'<<endl;
wcout<<'\u2655'<<endl;

in both cases, it's just printing '?'

Anyone here has any idea how this works?
I'm using Visual studio c++ console application.
 
No.. it's not in cmd.exe, i want to print them from my own application..

#include "stdafx.h"
#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
SetConsoleOutputCP(65001);
wcout<<'?'<<endl;
wcout<<'\u9812'<<endl;
}
 
Have you built it with the unicode flag set?
 
May be, it's console font problem? If console font has not chess gliphs (for example, in my system(s) no console fonts to show chess at all, so no sense to declare any code pages;)...
This post presented for discussion only...
 
If you are refering to the Charecter set in the general selection of the project properties pages, it's set to "Use Unicode Charecter Set".

If not, any chance you can specify where I find it?
 
The console will only take the Unicode characters available in Lucida Console font. You can't display all the characters in Arial MS Unicode, which includes the chess characters you're talking about.

Note that consoles tend to be made up of non-proportional fonts. Arial MS Unicode is a proportional font and can cause problems, especially with cursor addressing.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top