Skip to main content
gamedev.net
🔒 Locked

Unicode in console

Started by DarkSlayer 2 replies 400+ views
Original Post
DarkSlayer
DarkSlayer
I''m just looking into how to use unicode, and display scandinavian characters in console programs. Just doing this to learn, only for fun. Is it possible to display æøå? in a console? with unicode? and how? pls give a brief code example that will do excatly that, because I''m confused about this.... take a brief look on this:
#include <iostream>
#include <windows.h>
#include <tchar.h>	// Include Unicode support functions


#define UNICODE
using namespace std;

int main()
{
	SetConsoleCP( 1252 );
	SetConsoleOutputCP( 1252 );

	wprintf(L"æøå");
        return 0;
}
I belive SetConsole... only change what ascii page we are using (not true unicode). This ofcourse display the chars correctly, but it is not unicode?? I tried alot with wchar_t*, and to give it different values.. but still not correct output. pls help, thx in advance. I have been at msdn/google ... no luck, but I found stuff about the SetConsole...
DarkSlayer
DarkSlayer
No suggestions?

I also tried using coutw << "æøå"; But no...

Do I have to specify an language to be able to use unicode as intended?
Michalson
Michalson
No, you cannot use unicode in the console. The console is inherently an 8bit ascii display. When you go full screen with a console it is actually switching into a hardware text mode, and thus the console itself is limited to what can be shown in that hardware mode.
Wyrframe
Wyrframe
Not in a normal console or a hardware text mode, no... but I think I''ve seen software consoles which permit UTF-8 output (but only ASCII input)
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.