Alright... I've never used Unicode on the Win32 console before, but apparently it doesn't play nice with C++.
If you save your files as UTF-8
without the BOM marker g++ will pick up on it just fine.
If you want Unicode output, the
cout and
wcout streams libraries are
not the correct things to use. (There isn't one. Alas.) Both output "narrow" characters. The difference is that
wcout narrow()s the
wchar_ts it gets whereas
cout just barfs on them.
You can write Unicode to the console via the standard streams if you are willing to write your own
streambuf class that uses the correct output methods. The trick (whether you write your own streambuf or not) is to use the <windows.h> function
WriteConsoleW()
http://msdn.microsoft.com/en-us/library/ms687401(VS.85).aspx
There is one caveat: the Console "Prompt Properties" Font tab must list
Lucida Console as the active font.
(If you know what you are doing then you
can use others:
http://blogs.msdn.com/oldnewthing/archive/2007/05/16/2659903.aspx )
So far I haven't figured out how to set that programmatically yet, but if I do I'll let you know.
For those on Linux you will want to take a read through this:
http://www.cl.cam.ac.uk/~mgk25/unicode.html
What a sticky mess, no? :-(
[edit]
That is all for full Unicode support. If you can find an editor that just uses the MS 437 code page then you can compile and use the "extended ASCII" characters without problem. Read more about CP437 here:
http://en.wikipedia.org/wiki/Code_page_437