In Windows PowerShell I have used chcp 65001
and chosen a font that includes all of the characters I want.
If I display a UTF-8 file with type file.u8
it works fine and I get the desired characters.
If I run myprogram.exe
then I get no output after the first non-ASCII character (if run prior to chcp 65001
this produces mojibake).
If I run myprogram.exe > test.u8
followed by type test.u8
that works, and I get the desired output.
So I reasoned I could bypass the file (using my limited PowerShell knowledge!) with myprogram.exe | % {echo "$_"}
and that works. So it seems like the C++ runtime is doing something special when it is talking directly to a console which is breaking UTF-8 output.
(And I can get the desired output if I use wide characters, but I don't actually want UTF-16 output in the end, I want UTF-8. I just want the convenience of printing debug information without extra character transformations)