News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Wrong accentuation in the Windows Console

Started by lucrol, May 24, 2025, 06:48:37 PM

Previous topic - Next topic

lucrol

Hello, I am a French user new to Code::Blocks.
I am simply translating "Hello World" to test accented characters, but I am encountering an error because the console on my PC (configured for fr-FR) is set to code page 850.
By checking the properties of the Windows console window launched by Code::Blocks during execution, I can confirm this.
(screenshot_1)
Even if I modify the console's code page definition in the Windows registry, Code::Blocks does not take it into account!
(screenshot_2)
However, if I open a Windows console outside of Code::Blocks and change the code page (e.g., 1252 for French fr-FR), it works.
(screenshot_3)
But I cannot find a way to add the command:
CHCP 1252 > null
as the first line in the console when launching the executable (Run).
Could we find a solution (perhaps i miss something) ?
Ideally, it would be great if a global setting allowed this action automatically.
Thank you for the quality of this IDE.
Best regards.
Luc

lin_lcs

You can include the header file <cstdlib>, and in the main function, add the line system("chcp 1252") before calling std::cout.