You are using the exact opposite of Unicode. The console operates with an 8-bit code page, the default one on Western machines is code page 437. Which matches the character set of the old IBM PC character ROM and is the code page that most legacy DOS programs expect. The first set of character codes, codes 0 through 8 look like this:

Note the smiley face for code 0x02, the one you saw on your console. You can see the rest of the glyphs in this Wikipedia article. A nasty problem with 8-bit character encodings is that there so many of them. Notepad reads your file with a different code page. By default that's Windows-1252 on machines in Western Europe and the Americas. That page doesn't have any glyphs for the control codes which is why you didn't see the smiley in Notepad.
Dealing with code pages is a major headache. That's why Unicode was invented.
Switching the console to a Unicode code page is possible. It however has to be still an 8-bit encoding, another legacy hang-over from console programs supporting output redirection. Which makes the right choice utf-8. You can switch from the console itself by typing chcp 65001
before starting your program. Or you can do it in your code, call SetConsoleOutputCP(CP_UTF8);
.
One more unfortunate detail you have to take care of, you also need to change the font that's used for the console. The default font is TERMINAL, a legacy font that was designed to display the IBM PC glyphs but doesn't know beans about Unicode. Use the system menu to switch (press Alt+Space, Properties), not much to choose from but Consolas or Lucinda Console are suitable.
Now you can display Unicode, that's a whole other story that Remy introduced.