Here are the permutations that compiled. (The ones I least expected to work, worked correctly.)
Originally Posted by nvoigt
Probably not fault of terminal, as the string can be typed there.
Strangely, cout seems to work with C++11 unicode ..or plain strings containing unicode chars.
using namespace std;
//When file is saved as utf-8 :
//cout<<"মনসিজ"; //Expected Output (Why ?)
//wcout<<"মনসিজ"; //NO output
//wcout<<u8"মনসিজ"; //NO output
//wcout<<L"মনসিজ"; // Output: "?????"
//wcout<<L"\x0987";//Output : "?" (Trying a single char)
////cout<<L"মনসিজ"; //Output: 0x80486a8
//cout<<u8"This is a Unicode Character: \u0987.";
//(Wikipedia example): Worked (Why ?)
//When file is saved as utf-16 :
///FAILS TO BUILD
//with errors like :
//a.cpp:1:2: warning: null character(s) ignored [enabled by default]
//a.cpp:1:3: error: invalid preprocessing directive #i
I thought stream support for unicode was postponed in C++11 as it was not ready. (Is this gcc specific ?)
Another thing I tried, which did not work(Probably the reason for it being absent in C++11).
file_1 and file_2 are utf-16 files
if(ifs && ofs)
//Gives a Didn't Work #2 (as below) and the output file remains empty.
//This works with normal streams for copying files.
//terminate called after throwing an instance of 'std::bad_cast'
cout<<"Didn't work #1"<<endl;
cout<<"Didn't work #2"<<endl;