Hi All,
I'm attempting to write a wstring to a file by way of wofstream. I'm
getting compression on the stream (I presumed it is UTF-8, but maybe
not). How/where do I invoke an alternate constructotor so that the
stream stays wide (UTF-16)?
This may be broken. wstring ws = L"wide" produces:
77 69 64 65 ('wide' using 7 bit/8 bit ASCII)
When I change wstring ws = L"wide" to wstring ws = L"wide
\u9aa8" (added the wchar_t for U+9AA8), the file is as follows:
77 69 64 65 6F ('wide' with garbage 6F)
Any ideas?
Jeff
Jeffrey Walton
== Sample ==
wstring ws = L"wide";
wofstream ofs;
ofs.open("wide.dat", std::ios::binary | std::ios::trunc );
if( !ofs.good() ) { return; }
ofs << ws;
ofs.close();
== End Sample ==