• Advertisement

Archived

This topic is now archived and is closed to further replies.

Unicode in console

This topic is 5103 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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...

Share this post


Link to post
Share on other sites
Advertisement
No suggestions?

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

Do I have to specify an language to be able to use unicode as intended?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites

  • Advertisement