This could be done with the standard approach: by composing the registry settings for the executable being debugged. My template dbg_console.reg
:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\<encoded_path_to_executable>]
"ScreenBufferSize"=dword:1388012c
"WindowSize"=dword:00340096
"FontSize"=dword:00100000
"FontFamily"=dword:00000036
"FontWeight"=dword:00000190
"FaceName"="Lucida Console"
"HistoryNoDup"=dword:00000000
"QuickEdit"=dword:00000001
"CodePage"=dword:000004e3
<encoded_path_to_executable>
is the string where \
is replaced with _
.
E.g.: Z:\prj\prj_name\out\debug\bin\program.exe
is transformed to Z:_prj_prj_name_out_debug_bin_program.exe
.
"CodePage"=dword:000004e3
sets the desired code page. It is important to choose a proper font.
Due to debug mode, the standard settings dialog called on the window header of a program console cannot function properly. However, you can get the desired settings via Windows cmd
started with Win+R
shortcut. They appear under the folder %SystemRoot%_system32_cmd.exe
or alike.
Thus, you exactly get the desired code page in the debug console of your executable without the need to setup code page conditionally at run time. The support of the 65001 code page can be determined from the keys in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
: if there is the key 65001
having appropriate *.nls
file, this page is supported.