I have been trying to get wchar_t streams working on Fedora. Shouldn't the following code print on wcout and on the file correct UTF-8 stream? The src in real source file includes UTF-8 encoded string The output of "printf("\n===\n%s%ls===\n", src, dst);" is two same correctly UTF-8 encoded strings. However, the 'wcout' screen output stops just before the first non-ASCII character. On the file I receive only the first line which has only ASCII chars. How can this be? I understood that codecvt used internally in fstreams uses wcsrtombs itself, so shouldn't wide C++ streams behave same way as %ls in C-printf? ========================================== #include <fstream> #include <iostream> #include <locale> #include <string> #include <stdlib.h> using namespace std; int main() { wchar_t dst[256]; unsigned char *ptr = (unsigned char *) dst; char *src = "This is a öäåÖÄÅ test\n"; locale::global(locale("fi_FI.UTF-8")); //locale::global(locale("")); cout << locale().name() << endl; wcout.imbue(locale()); cout.imbue(locale()); int i = mbstowcs(dst, src, 255); printf(">%d< %d\n", i, sizeof(dst)); for(int x=0; x<i*4; x++) printf("%02hx ", ptr[x]); printf("\n===\n%s%ls===\n", src, dst); wofstream myfile; myfile.imbue(locale()); myfile.open("log.log"); wcout << L"Testi " << endl << dst << endl; myfile << L"Rivi 1 " << endl << dst << endl; myfile.close(); }