Simple UNICODE question

  • Thread starter Roger Thornhill
  • Start date
R

Roger Thornhill

Hi -

I have a question that I am sure is a basic UNICODE question for
anyone out there with UNICODE experience.

I simply would like to see a non-Latin unicode character printed to my
console.

To do that, I have been attempting to:

(a) wcout << (wchar_t)38 << endl; // should print a semicolon
(latin)

and

(b) wcout << (wchar_t)297 << endl; // should print the copyright
symbol (latin supplemental)

or

(c) wcout << (wchar_t)8240 << endl; // should print the permil symbol

I have gotten (a) to work. (b) and (c) do not and I would be
interested to know why. I am assuming that I should also be able to
print out a kanji character or hangul (Korean) character, for example.

I've tried using different console fonts. I am wondering if I need to
setlocale().

Thanks...
 
R

Ron Natalie

Roger said:
Hi -

I have a question that I am sure is a basic UNICODE question for
anyone out there with UNICODE experience.
You'll have to ask this question on whatever group covers your
implementation. C++ doesn't mention UNICODE.
 
D

David Lindauer

Roger said:
Hi -

I have a question that I am sure is a basic UNICODE question for
anyone out there with UNICODE experience.

I simply would like to see a non-Latin unicode character printed to my
console.

To do that, I have been attempting to:

(a) wcout << (wchar_t)38 << endl; // should print a semicolon
(latin)

and

(b) wcout << (wchar_t)297 << endl; // should print the copyright
symbol (latin supplemental)

or

(c) wcout << (wchar_t)8240 << endl; // should print the permil symbol

I have gotten (a) to work. (b) and (c) do not and I would be
interested to know why. I am assuming that I should also be able to
print out a kanji character or hangul (Korean) character, for example.

I've tried using different console fonts. I am wondering if I need to
setlocale().

Thanks...

some versions of windows do not support anything other than pure ASCII in
consoles (e.g. the 9x/ME series). I think that those that do (e.g. the NT
platforms) will require you to change the console's code page setting to
whatever locale you are trying to use. I don't *believe* consoles can use
unicode, although I may be wrong...

David
 
A

ARatio

Hi Roger:


Roger Thornhill said:
Hi -

I have a question that I am sure is a basic UNICODE question for
anyone out there with UNICODE experience.

I simply would like to see a non-Latin unicode character printed to my
console.

To do that, I have been attempting to:

(a) wcout << (wchar_t)38 << endl; // should print a semicolon
(latin)

and

(b) wcout << (wchar_t)297 << endl; // should print the copyright
symbol (latin supplemental)

or

(c) wcout << (wchar_t)8240 << endl; // should print the permil symbol

I have gotten (a) to work. (b) and (c) do not and I would be
interested to know why. I am assuming that I should also be able to
print out a kanji character or hangul (Korean) character, for example.

I wrote something like your code and it worked fine in Windows XP:

wchar_t msg[100];
......
wprintf(L"La cigüeña come ñandúes %s\n", msg);


But when I ported that code to Linux, the console just showed:

La cig


I think that the terminal implementation in Linux does not allow Unicode
characters, but I cannot ensure it.

Best regards


Ernesto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,141
Latest member
BlissKeto
Top