> I have some unicode (utf8) text file. I _tried_ to write a simple
program that read one of them and write it to the standard output
but... of course it doesn't work
What character set do you want to use when writing to standard output?
If you want it to write using a character set other than the UTF-8 that
it read in, you need to do some conversion. You have to do this
explicitly. It will not happen automatically.
Assuming that your program is going to actually do something with the
text, rather than just reading it in and then writing it out again, you
need to decide what character set you want to use internally. I mostly
use UTF-8 internally and for input/output, so there is rarely any
conversion. I store this in chars. This is on Unix, and I'm in the
"western hemisphere". I understand that Windows programmers tend to
use UTF-16 quite often and that would also be sensible for non-European
languages. For that you should use wchars. You should not be using
ASCII for any new applications.
To actually perform the conversion you need something like the iconv
library. This is supported just about everywhere, but you'll want a
C++ wrapper for it to make it more palateable.
Regards, Phil.