In Windows NT the Windows console can handle Unicode, but, by default, when output is redirected from a command to a file it is converted to the current ANSI codepage, meaning that any characters outside the codepage will be converted to “?” characters.
This can be corrected by starting the console with the /u switch.
With my program running inside of a console, how can I detect whether the /u switch was used when the console was started up?
Here’s the documentation for the /U switch:
It seems pretty clear that this switch only affects the behaviour of commands interpreted by cmd.exe itself. Internally, it probably just sets some flag. There’s no way to read that value from an external process.
I think your best bet would be to try and retrieve the command line of the launching cmd.exe instance. This is not a recommended pactice, but it should be safe in your case. Here’s an article that explains how but please make sure you understand the caveats.
How do I get the command line of another process?
You can use GetConsoleProcessList() to find the hosting cmd.exe process.