Use UTF-8.
The UTF-8 encoding of Unicode U+263A is
"\xE2\x98\xBA"
. You can literally google any U+ code point and get a gazillion sites that want to tell you what it is and what it looks like in any UTF encoding you want.
Just as easy, though, is to use an editor that will save your source file as UTF-8, and insert the character directly.
"☺"
Check your compiler documentation to make sure it takes UTF-8 input, and compile like normal.
The next important thing to do is make sure your output device (the terminal) accepts UTF-8. On Windows, you can type "
chcp 65001
" to make sure your console is in UTF-8 mode. Or, you can use
https://www.google.com/search?btnI=1&q=msdn+SetConsoleOutputCP
in your code to fix that, if you are willing to
#include <windows.h>
.
Another option would be to create a batch file that sets things up for your program and runs it.
1 2 3
|
@echo off
chcp 65001
my_program.exe %*
|
You will have to be a little creative on naming, though, since EXE files take precedence over same-name BAT files. (Stupid, yes, but alas, DOS did it that way...)
Good luck!