MinGW has not (as yet) implemented the <codecvt> C++11 header. (IDK why online resources say this would require a change in the library DLL.)
So I wrote my own.
locale loc( locale(), codecvt_utf16 <wchar_t> ); wofstream f( "foo.txt" ); f.imbue( loc ); f << "Hello world\n";
This produces an output sequence terminating in
0D 0A 00
Instead of the (correct)
0D 00 0A 00
I could, of course, just open the file in binary mode, and get:
But that is beside the point.
Is there a reason that the text mode newline translation is not using the codecvt facet to insert characters in the output stream?