OK, slow down a bit.
There are
several encodings at work, here.
- The encoding your source is written in (i.e. what your text editor saves).
- The encoding you're telling your compiler your source is written in.
Basically, the language standard doesn't guarantee anything beyond the "Basic Character Set" to actually work. That would be the printable characters present in ASCII-7,
minus $ and ` (backtick). So, yes, you could write your source in ISO-8859-2 or UTF-8, and many compilers might actually support that, but purist that I am, personally I wouldn't use any non-ASCII-7 characters in source, and instead use character escapes. But that's just me. The important thing is that those two encodings
match, or your executable won't hold the characters you think it holds. You can check this easily by inspecting the generated object code, with a hex editor if nothing more sophisticated is at hand.
Then we go on:
- The encoding that is written to stream (by printf() or whatever).
- The encoding that the output device is set to accept.
Again, it's very important that the two
match.
And then the output device must actually
support that encoding properly....
(There are actually even more points of encoding in play here, depending on how your development environment is set up. Your terminal in which you do the development, for example. But I hope I gave an idea how important it is that the parties involved actually
agree on the encoding used...)