OEM Extended ASCII in UNIX

How can I get my unix terminal's stdout to use a different character set (e.g. the OEM extended ascii set that DOS uses). I'm trying to use ascii graphics for a game.
[177 byte] By [TommySzalapski] at [2007-11-20 2:59:56]
# 1 Re: OEM Extended ASCII in UNIX
I think it depends on your terminal's configuration not in your program.
Carlos Martinez at 2007-11-9 1:10:08 >
# 2 Re: OEM Extended ASCII in UNIX
You can try to set the LC_CTYPE or LC_ALL environment variables to something like LC_ALL=en_US.OEM

However, your UNIX terminal might not know at all the OEM encoding.
It would probably know ISO-8859-1 or ISO-8859-15, but probably not the DOS OEM extended ASCII character set.
Nevertheless, you can check your documentation.

If your system doesn't support this character encoding, you can write a function that converts OEM characters to unicode characters, and then, using the UTF-8 encoding (if your system support it), you would be able to display all those characters on your terminal.
Unfortunately, OEM characters may be not all supported by unicode itself!
SuperKoko at 2007-11-9 1:11:14 >
# 3 Re: OEM Extended ASCII in UNIX
Okay, I think unicode is the direction I need to go. I am having trouble printing unicode characters, however.

setenv("LANG", "en_US.UTF-8", 1);
cout<<"\u03b2";

03b2 is the unicode value for the greek beta (which can print on my terminal) but the code prints an I and a superscript 2.
How am I supposed to specify unicode characters in c?
TommySzalapski at 2007-11-9 1:12:10 >
# 4 Re: OEM Extended ASCII in UNIX
Okay, I think unicode is the direction I need to go. I am having trouble printing unicode characters, however.

setenv("LANG", "en_US.UTF-8", 1);
cout<<"\u03b2";

03b2 is the unicode value for the greek beta (which can print on my terminal) but the code prints an I and a superscript 2.
How am I supposed to specify unicode characters in c?
The environment variable must be set in the environment of the terminal when it's startup, not of your program!
In fact, if it's an X terminal in an X system, I think you have to set the environment variable before launching the X system.

Then, once the terminal is in unicode mode, you have to send UTF-8 bytes to it.
You can do it through two main ways.
1) Manually send a binary UTF-8 stream
2) Use the fputwc/fputws and other C95 wide character functions.
In that case, you have to call setlocale(LC_ALL, ""); in order to specify that the C library must convert from wide characters to the current locale character encoding.

Note: The OEM character set is perhaps named "DOS850"
SuperKoko at 2007-11-9 1:13:07 >