I know that it can be checked by the user with the command chcp. Here I ask how to do this from another program using a handle to the console process.
chcp
You can get the console code page attached to the current process with GetConsoleCP. I do not see the corresponding function that works with any console descriptor.
GetConsoleCP